Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Placing a Home link in angular material toolbar

I have this markup:

 <mat-toolbar>
   <span>MyAppName</span>
 </mat-toolbar>

Now I want the span to be a link to home, so I did:

 <mat-toolbar>
  <button routerLink="/" mat-button>
    MyAppName
  </button>
</mat-toolbar>

Works as expected except the font size of the caption is, obviously, much smaller. So my assumption is this is not now you address this scenario.

What would be the "native material" way of placing static text and make it work as home link?

like image 945
user776686 Avatar asked Oct 24 '25 04:10

user776686


1 Answers

The RouterLink directive can be used on other elements, and you can add style to make it interact like a link:

<span [style.cursor]="'pointer'" routerLink="/">MyAppName</span>
like image 140
G. Tranter Avatar answered Oct 25 '25 18:10

G. Tranter