Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

router link attribute within the button tag doesnt work

I am unable to navigate with router link attribute that is placed within the button tag. Here is my code,

<button mat-raised-button color="primary"><a routerLink="/message-inbox">Inbox</a></button>
    <button mat-raised-button color="accent"><a routerLink="/sent">Sent</a></button>
    <a routerLink="/message-compose"><button color="warn">Compose</button></a>
like image 311
Karty Avatar asked Dec 05 '17 11:12

Karty


1 Answers

You can apply routerLink to the button directly. It doesn't have to be an <a element

<button mat-raised-button color="primary" routerLink="/message-inbox">Inbox</button>
like image 116
Günter Zöchbauer Avatar answered Sep 19 '22 16:09

Günter Zöchbauer