Filter on ng-repeat with ng-model value

江枫思渺然 提交于 2020-02-29 04:25:23

问题


I need to filter ng-repeat on value of ng-model Like this :

 <select class="browser-default" ng-model="planning.uuid" id="planning" ng-options="planning.uuid as planning.day for planning in plannings" ng-change="loadRegistration(planning.uuid)">
      <option value="" disabled selected>Planning</option>
 </select>
...
<table...
   <tr ng-repeat="registration in registrations" >
     <td ng-repeat="rate in registration.rate | filter: rate.activity.uuid: planning.activity.uuid">
          {{rate.type.label}}
     </td>
  </tr>
</table>

My problem is it's seems that the filter rate.activity.uuid: planning.activity.uuid doesn't works.

Please what is the good way ?


回答1:


Change your filter to

 <td ng-repeat="rate in registration.rate | filter: {activity : {uuid: planning.activity.uuid}} :true">
      {{rate.type.label}}
 </td>


来源:https://stackoverflow.com/questions/33996751/filter-on-ng-repeat-with-ng-model-value

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!