我想在 angular2 组件上设置一个 bool 属性。
鉴于以下(这是不正确的)...
。 Dart
@Component
....
@Input()
bool hasColour = false;
.html
...
<span [class.blue-colour] = 'hasColour'></span>
...
<colour-component hasColour></colour-component>
...我怎样才能解决上述问题,以便能够使用 hasColour 绑定(bind)一个类?
谢谢
最佳答案
绑定(bind)到 hasColour 输入属性:
<colour-component [hasColour]="true"></colour-component>
关于dart - 在 angular2 中设置自定义 bool 属性的正确语法是什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35402307/