Angular.js: filter ng-repeat by absence in array

后端 未结 1 1048
孤城傲影
孤城傲影 2021-02-13 22:47

I need to filter items in ng-repeat so that only the items which not appear in alreadyAddedValues() array will be shown:

    &
1条回答
  •  孤城傲影
    2021-02-13 23:07

    You can, for example, use a custom function to do the filtering:

  • {{value.name}}
  • On the controller:

    $scope.filterAlreadyAdded = function(item) {
        // filter logic here...
        // return false if item already added, true otherwise
    };
    

    jsfiddle: http://jsfiddle.net/bmleite/5VbCJ/

    0 讨论(0)
提交回复
热议问题