Maison  >  Questions et réponses  >  le corps du texte

angular.js - | filter: {name: someText}这种用$filter在controller中如何写啊

在controller中写currency过滤器是

$filter('currency')(12233243)

那如果要实现下面这个过滤器该怎么写呢?

<tr ng-repeat="product in products|filter:{brand: brandName}">
曾经蜡笔没有小新曾经蜡笔没有小新2687 Il y a quelques jours582

répondre à tous(2)je répondrai

  • 天蓬老师

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

    Je l'ai trouvé.

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

    répondre
    0
  • phpcn_u1582

    phpcn_u15822017-05-15 16:59:09

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

    répondre
    0
  • Annulerrépondre