Angularjs filter not null

后端 未结 4 1561
执笔经年
执笔经年 2020-12-04 14:14

Trying to filter out items with a certain property that is not null So for:

var details = [{name:\'Bill\', shortDescription: null}, {name:\'Sally\', shortDes         


        
4条回答
  •  时光取名叫无心
    2020-12-04 14:30

    Angular >=1.3.16 to latest (1.5.5 at time of writing/update) use '' (empty string) (or '!!' also works)

    • {{detail.shortDescription}}

    Example: http://jsfiddle.net/TheSharpieOne/1mnachk6/


    Angular >=1.3.6 and <=1.3.15 use '!null'

    • {{detail.shortDescription}}

    Example: http://jsfiddle.net/TheSharpieOne/4wxs67yv/


    Angular >=1.2 and <=1.3.5 use '' (empty string) (or '!!' also works)

    • {{detail.shortDescription}}

    Example: http://jsfiddle.net/TheSharpieOne/ovsqf17n/


    Angular <1.2 '!!'

    • {{detail.shortDescription}}

    Example: http://jsfiddle.net/TheSharpieOne/RGEdc/


    Overall, '!!' has the best support, but '' (empty string) is recommended and intended for this.

提交回复
热议问题