4
使用下面的表達式,我期待Angular通過日期管道插入日期(如果不爲空),但是我得到了繼續的錯誤。在條件表達式中使用日期管道 - Angular 2
{{charge.offenseDate ? charge.offenseDate | date : 'No date'}}
EXCEPTION: Error: Uncaught (in promise): Template parse errors:
Parser Error: Conditional expression {{charge.offenseDate ? charge.offenseDate | date : 'No Date' }} requires all 3 expressions at the end of the expression
就是我期待有可能,或者只是一個... 白日夢 :)
你試過'{{負責包裹。犯罪日期? (charge.offenseDate | date):'No date'}}'? –
@GünterZöchbauer不,我不認爲這樣做,但我只是做了,它工作。如果您將它作爲答案彈出,我會很高興接受它作爲正確答案。 – sharpmachine