Reputation: 1673
I am trying to move an icon in a Angular (NOT -JS) Material Design navigation list to the left of the list.
I have two snippets:
md-icon
on the left of the title and description, even though it appears first in the list item. I could do { position: absolute; left: 0px}
, but I hate hacks like that and would like to avoid it, if possible (not sure why it would default to appear on the right even though it appears first in the list...).
md-icon
somewhat to the left of the title and description.<md-nav-list>
<a md-list-item class="md-3-line" *ngFor="let group of groups$ | async" [routerLink]="[configuration.baseUrl + '/group', group.id]">
<md-icon>group</md-icon>
<h4 mdLine>{{group.name || 'Title'}}</h4>
<p mdLine class="demo-2"> {{group.description || 'Description'}} </p>
<button md-button>
<md-icon>mode_edit</md-icon>
</button>
<button md-button>
<md-icon>delete</md-icon>
</button>
<md-divider></md-divider>
</a>
<md-divider></md-divider>
</md-nav-list>
<md-list-item class="md-3-line" *ngFor="let group of groups$ | async">
<a [routerLink]="[configuration.baseUrl + '/group', group.id]">
<md-icon>group</md-icon>
<h4 mdLine>{{group.name || 'Title'}}</h4>
<p mdLine class="demo-2"> {{group.description || 'Description'}} </p>
</a>
<button md-button>
<md-icon>mode_edit</md-icon>
</button>
<button md-button>
<md-icon>delete</md-icon>
</button>
<md-divider></md-divider>
</md-list-item>
How can I have the nice look of the navigation list with an icon on the left of the title and description?
Upvotes: 2
Views: 2343
Reputation: 2049
I did it by adding the mdListIcon
attribute to the md-icon
:
<md-icon mdListIcon>group</md-icon>
Upvotes: 2