Json 基于字符串长度的角度滤波

Json 基于字符串长度的角度滤波,json,angularjs,Json,Angularjs,我有一个角度视图,它循环JSON数据并返回表单中的所有值;但是,提交的每个表单在不同的位置都有空值。我希望返回每个节的数据,但仅当字符串长度大于0时才返回。有没有角度过滤器可以做到这一点 以下是我的视图数据: <div data-ng-repeat="n in [] | range:100"> <div class="calendar" ng-repeat="cal in calendar[n].year | filterKey:month"> <div cla

我有一个角度视图,它循环JSON数据并返回表单中的所有值;但是,提交的每个表单在不同的位置都有空值。我希望返回每个节的数据,但仅当字符串长度大于0时才返回。有没有角度过滤器可以做到这一点

以下是我的视图数据:

<div data-ng-repeat="n in [] | range:100">
<div class="calendar" ng-repeat="cal in calendar[n].year | filterKey:month">  
<div class="events">
 <div ng-repeat="(val, key) in cal">
  <a href="/events/{{key.day}}">
  <article class="eventslist">
   <div class="numberedDate">
   <h3>{{key.day}}</h3>
    </div>
    <div class="calInfo">
     <h5>{{key.title}}</h5>
     <p>{{key.summary}}&nbsp;<a>more</p>
     </div>
     </article>
     </a>
</div>

对于6月份,这很有效,但对于其他11个月,最好不要返回任何数据。

您是否尝试输入循环不变量,使其成为循环不变量,以便在每次循环中循环N个元素

<script>
var objectJson = /*the object that you get in JSON*/;
var structID = objectJson._id;

$_.each( objectJson, function( i, j) {
    //check for each v = 0 for every structID given the JSON ID

    if($(this).objectJson.structID.v = 0) {
        //do what you want with it
    }
});
<script>

如果您的ng repeat div中存在可能的情况,请尝试使用数据ng。可能会起作用

<script>
var objectJson = /*the object that you get in JSON*/;
var structID = objectJson._id;

$_.each( objectJson, function( i, j) {
    //check for each v = 0 for every structID given the JSON ID

    if($(this).objectJson.structID.v = 0) {
        //do what you want with it
    }
});
<script>