search

Home  >  Q&A  >  body text

angular.js - | How to write filter: {name: someText} using $filter in the controller?

Writing currency filter in controller is

$filter('currency')(12233243)

How to write the following filter if you want to implement it?

<tr ng-repeat="product in products|filter:{brand: brandName}">
曾经蜡笔没有小新曾经蜡笔没有小新2832 days ago666

reply all(2)I'll reply

  • 天蓬老师

    天蓬老师2017-05-15 16:59:09

    I've found it.

    $scope.filteredProducts = $filter('filter')($scope.products, $scope.brand);

    reply
    0
  • phpcn_u1582

    phpcn_u15822017-05-15 16:59:09

    angular.module('yourApp').filter('brand', function(){
        return function(input){
            // 逻辑
            
        }
    })

    reply
    0
  • Cancelreply