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可以接受它,問題將顯示爲已回答。 –