Lyubimov Roman
Lyubimov Roman

Reputation: 1269

RouterLink don't adds href at first load from parent page template

I have root page with child pages, root page template has [routerLink] directives that route to child pages. Something like this:

<a [routerLink]="['/home', 'auidiences']"></a>
<router-outlet></router-outlet>

HomeComponуnt has ROUTER_DIRECTIVES in directives section.*

When I navigate to page at first time links don't have hrefs, but if I update page they do and work. Any idias?

Upvotes: 0

Views: 753

Answers (1)

Lyubimov Roman
Lyubimov Roman

Reputation: 1269

The reason is as I understand related to this bug. And one more - user answer. OnInit doesn't fire and there is no component that works fine after router navigation.

To solve this problem you need to wrap your navigation call into zone.run().

Upvotes: 1

Related Questions