[英]How to dynamically change property of an Ionic element in angular html template?
I would like to change the outline property of ionic-chip if an observable changes:如果可观察到的变化,我想更改 ionic-chip 的轮廓属性:
<span *ngIf="(avgRating | async) as obs">
<ion-chip outline= "obs.total > 0 ? 'none' : 'outline'">
// change outline property if observable changes
</ion-chip>
</span>
Is it possible to do this in the template file?是否可以在模板文件中执行此操作?
The outline property of an ion-chip is a boolean value.离子芯片的轮廓属性是 boolean 值。 Therefore, you cannot set 'none' or 'outline' to it as they are strings.
因此,您不能为其设置“无”或“大纲”,因为它们是字符串。 Therefore, it would just be enough to check and return output of obs.total > 0 to the outline attribute.
因此,检查 obs.total > 0 的 output 并将其返回到大纲属性就足够了。
Ref: https://ionicframework.com/docs/api/chip参考: https://ionicframework.com/docs/api/chip
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.