What is it that you are trying to do? Do you want to use the <i> element or the <ion-icon> element?
I think the error tells you that name is not a binding for <i> element. https://www.w3schools.com/tags/tag_i.asp the <i> is making the text italic and can’t be used for <ion-icon> if that is what you want to do.
Ok but if you look at the link that is sent previously https://www.w3schools.com/tags/tag_i.asp you can see that this is something that makes the text italic, and that it doesn’t have any binding to name defined (binding is something that exists in the angular work and something that exist in pure html). <ion-icon> and <i> are two different tags that doesn’t have the same binds. <ion-icon> enables you to bind something to “name” attribute ([name] is an attribute binding). <i> doesn’t allow you to bind anything to name as it doesn’t need it.
I’m not really sure what you are trying to create here, but if you could describe that then I might be able to help you. I just tried to describe the difference between <i> and <ion-icon>.
Sorry for all the edit, I didn’t realize that tags didn’t show by default
Thanks, as I need to this pretty quick for a demo I have for my job, I just did the following for now which works. I’ll need to do it in a more elegant way after of course:
If you just want 2 different icons depending on a state then you could do like in my example below. and “option.expanded” is a true or false boolean.
Its not that I want 2 icons, it’s that my organization makes me use i insead of ion-icon for some reason that I don’t understand. But now it’s solved more or less
So you don’t use ion-icon at all. Because in your case you don’t need it I think. It might just do more harm than good.
You should almost only use ion-icon when you are going to use your icon from here https://ionicframework.com/docs/ionicons/ . Then you can get the power from ionic as well.