Reputation: 35
I've set up the routing fine and I can load the pages up via the address bar, however when I try to access them via a onClick button, nothing loads. When I set them up as a Component however they do show up so the information is there
Button:
<div class="content">
<button _ngcontent-c2="" class="raiys-primary-button" type="submit" onclick="next()">
Next
<div _ngcontent-c2="" class="ripple-container"></div>
</button>
</div>
Typescript class:
next(){
this.router.navigateByUrl('/next-page');
}
Stackblitz code
https://angular-ivy-trdt3q.stackblitz.io
Upvotes: 0
Views: 490
Reputation: 429
In Angular you need to use (click)="yourFunction()" notation instead of the normal JavaScript "onClick".
-> https://angular.io/guide/event-binding
Upvotes: 1