如何设置clr-icon的形状属性

How to set shape attribute of clr-icon

我正在使用 <clr-icon shape=""/>。我想让它的 shape 动态化。如果我指定 <clr-icon [shape]="shapeValue"/> 它会抛出一个错误 shape is not a known 属性 of clr-icon

这并不是真正的清晰函数,这是因为组件 clr-icon 使用了 shape HTML attribute without declaring it an @Input (it's not an angular component, it's a WebComponent)

为了能够动态设置 HTML 属性,您必须使用特殊格式 [attr.shape] 这样 Angular 就不会查找 @Input 属性.

参见 https://plnkr.co/edit/8qepCA9kgaQejzwXdp5H?p=preview