AngularJS doesn't work with 'multiple' flag

时光总嘲笑我的痴心妄想 提交于 2019-12-02 08:17:38

You can create custom function for filter

Updated code

<tbody align="left">
        <tr ng-repeat="todo in todos | **filter: filterByGenres** | orderBy: 'application' ">
          <td>{{todo.application}}</td>
          <td>{{todo.environment}}</td>
          <td>{{todo.statusUp}}</td>
          <td>{{todo.statusDown}}
            <td>
        </tr>

angular controller side code

    (function(angular) {
  angular
    .module('plunker', ['ngMaterial'])
    .controller('monitoring', function($scope, $http) {

      **$scope.filterByGenres = function(ele) {
        var res = true
        if ($scope.selectedEnvironments !== null && $scope.selectedEnvironments.length > 0) {
          if ($scope.selectedEnvironments.indexOf(ele.environment) == -1) {
            res = false;
          }
        }
        if ($scope.selectedApplications !== null && $scope.selectedApplications.length > 0) {
          if ($scope.selectedApplications.indexOf(ele.application) == -1) {
            res = false;
          }
        }
        return res;
      }**

      $scope.segments = [
        "SegmentA",
        "SegmentB",
        "SegmentC"
      ];
...

Plunker here

Thanks

I just run your source on codepen.io and nothing output, try included md then everything ok. So, please try use .module('monitor', ['ngMaterial']) and test again.

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