2
我写了一个名为wordsAllDone
的点来检查是否所有的单词都标记为done
,它的输出是一个布尔值。 但是,我想让这个按钮隐藏,当words | wordsAllDone
是true
并显示它的时候是false
。可以在angular2模板中使用管道(|)使用'=='吗?
<button *ngIf="words | wordsAllDone == false" (click)="startReview()">START</button>
但angular2显示解析错误:
<button [ERROR ->]*ngIf="words | wordsAllDone == false" (click)="startReview()" ion-button item-right outline>START</button>:[email protected]:20
Parser Error: Unexpected token ==, expected identifier, keyword, or string at column 22 in [words | wordsAllDone == false] in [email protected]:20
我可以使用==
运营商与|
在同一时间?
您是否尝试使用圆括号来阐明您想要的内容 - '(words | wordsAllDone)== false'? – jonrsharpe
工作正常!非常感谢。 @jonrsharpe – awmleer
@jonrsharpe如果您将此添加为答案awmleer可以接受它,问题将显示为已回答。 –