AngularJS过滤器无过滤器空属性
当对象的属性不存在并且无法使用AngularJS过滤器无过滤器空属性,angularjs,Angularjs,当对象的属性不存在并且无法使用“!null”进行筛选时,我遇到了一个问题,我想知道筛选器是否可以验证该属性,或者我需要为此创建一个新筛选器 Htmlng repeat <li ng-repeat="detail in details | filter:{shortDescription: '!null'}"> <p>{{detail.name}}</p> </li> 结果 账单2 萨莉 Bill2不存在shortDescripti
“!null”
进行筛选时,我遇到了一个问题,我想知道筛选器是否可以验证该属性,或者我需要为此创建一个新筛选器
Htmlng repeat
<li ng-repeat="detail in details | filter:{shortDescription: '!null'}">
<p>{{detail.name}}</p>
</li>
结果
- 账单2
- 萨莉
shortDescription
,但没有筛选器
预期结果:
- 萨莉
v.1.3.15
我如何做到这一点?您可以尝试使用双not运算符,如下所示
<li ng-repeat="detail in details | filter:{shortDescription: '!!'}">
<p>{{detail.name}}</p>
{{detail.name}
可能的重复您是否可以用答案更新小提琴..此处不起作用我需要过滤器,但当不存在属性时:result=*Sally
<li ng-repeat="detail in details | filter:{shortDescription: '!!'}">
<p>{{detail.name}}</p>