角离子图标结合不编译
我有一个自定义版本的< ion-select>
我使用标准< ion-select-option>
。
<custom-select>
<ion-select-option></ion-select-option>
</custom-select>
当我像这样绑定图标时,
<ion-select-option value="test" icon="information-circle">
Test
</ion-select-option>
代码编译,自定义包装器组件会在适当的位置添加图标。
但是,当我这样绑定时,
<ion-select-option value="test" [icon]="getIcon()">Test2</ion-select-option>
我会得到错误无法绑定到“图标”,因为它不是“离子 - 选择选项”的已知属性。
我需要后者,因为添加图标是有条件的。
示例: stackblitz链接
I have a custom version of <ion-select>
under which I use the standard <ion-select-option>
.
<custom-select>
<ion-select-option></ion-select-option>
</custom-select>
When I bind an icon like this
<ion-select-option value="test" icon="information-circle">
Test
</ion-select-option>
The code compiles and the custom wrapper component takes care of adding the icon in the appropriate place.
But when I bind it like this
<ion-select-option value="test" [icon]="getIcon()">Test2</ion-select-option>
I get error Can't bind to 'icon' since it isn't a known property of 'ion-select-option'.
I need the latter because adding the icon is conditional.
Example: stackblitz link
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
ion-select-option
没有iCON
属性,检查 docs您可以创建自己的选择组件并加载到 popover
例如
component.html
component.ts
home.ts home.ts
ion-select-option
don't haveicon
property, check the docsYou can create your own select component and load into a popover
For example
component.html
component.ts
home.ts
我找到了一个解决方案,使用
attr.icon
工作:我仍然不知道为什么它有效,尽管离子选择选项没有正式具有ICON属性。
I found a solution, using
attr.icon
works:I still don't know why it works although ion-select-option does not have icon attribute officially.