Operator '>' cannot be applied to types 'boolean' and 'number'?


https://stackoverflow.com/questions/45974764/operator-cannot-be-applied-to-types-boolean-and-number

Im using this block in my html template :

  <div *ngIf="visibleblock && !selected?.item?.externalInfo?.length > 0">

But im getting this error when i do:

ng build --prod --aot

Any suggestion how can i fix this ?

      

Put the second expression inside parenthesis:

<div *ngIf="visibleblock && !(selected?.item?.externalInfo?.length > 0)">

原因是 , !變成了boolean類型, 然后他 不能用>0比較。 需要吧 length>0 括號括住然后再加!。

小細節啊!
 
 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM