zyra/ionic-material-icons

Can't use with interpolated / bind / variable or values

Opened this issue · 2 comments

Hi, i can use this with a fixed value like <ion-icon md-name="settings"></ion-icon>, but it won't work with interpolated/bind values like <ion-icon [md-name]="variable"></ion-icon> or <ion-icon md-name="{{variable}}"></ion-icon>.

The problem is your css or font is tied to the attribute md-name, but when you interpolate or bind, the attribute seems to be removed form the html. A quick workaround is to add an extra empty md-name when interpolating:
<ion-icon md-name [md-name]="'settings'"></ion-icon>

Thanks for pointing this out. I will look into it. Maybe it can become something like this:

<!-- fixed value -->
<ion-icon md name="settings"></ion-icon>
<!-- with variable -->
<ion-icon md [name]="someVariable"></ion-icon>