2015-07-22 45 views
0

對於下面的代碼,是否有角度來包含一個內聯條件,只顯示帶時間表的ng-repeater中的時間表,如果{{schedules.position}} = {{position.position}}?如何在這個例子中使用Angularjs內聯條件?

  .positions(ng-repeat='position in positions') 
      .row 
       {{position}} 
       .row 
       .col-sm-4.col-md-4 
       .col-sm-8.col-md-8 
       .schedule(ng-repeat='schedule in schedules') 
        .row 
        .col-sm-1.col-md-1. 
         %input(ng-model = "string" type = 'checkbox') 
        .col-sm-7.col-md-7. 
         %table 
         %tr 
          %td 
          {{schedule.first_name}} 

回答

0

是的...只是刪除{{}}和使用比較運算符

<div ng-if="schedules.position == position.position"> 

讓你從HTML轉換因爲我不熟悉你的模板語法

0

爲您的範圍添加一個功能,爲您過濾。

$scope.filterSchedule = function(pos) { 
    return _.filter(schedules, function(sch) { 
     return sch.position == pos; }); 
    } 

然後你內心的重複可能是

ng-repeat="schedule in filterSchedule(position)" 
相關問題