'ion-anchor' is not a known element:

I’m using Ionic 4.

I have defined an anchor tag like

<ion-anchor href="/forgot" routerDirection="forward">
    Forgot Password?
</ion-anchor>

But this is giving an error

'ion-anchor' is not a known element:

The documentation describes it

I also have same issue. Is there anyone lucky!

Same issue here.

'ion-anchor' is not a known element

I want to call a function from an anchor rather than a button and assumed this was the place/method to do that. Is there another/better way?

Example:

<p>
Option 1: <ion-anchor href="myFunction()">Clear Data</ion-anchor>
</p>

Did anyone find a fix for this?

I would suggest ensuring that IonicModule is imported in the module containing whatever component is throwing this problem.

:wave: Hey folks!

ion-anchor is not actually needed in an Ionic Angular app, since we have routerLink. It looks like there’s some docs not getting copied over, but there should be a note in the docs about this.

Note: this component should only be used with vanilla and Stencil JavaScript projects. For Angular projects, use an <a> and routerLink with the Angular router.

So ion-anchor should not be used here.

2 Likes