javascript - How to get the return filter array data in angular js controller? -


i'm using custom filter application.

 div class="cust-post" ng-repeat="post in newsfeeddata | customfilter:companyfilters" 

in above code customfilter return array data need use array data controller.

i don't know how retrieve array data.

anyone please assist me.

try as keyword within ng-repeat, can access filtered array via $scope.array:

angular.module('app', [])  .controller('ctrl', ['$scope', function($scope) {      $scope.items=[        {name:'a'},        {name:'ba'},        {name:'cb'},      ];      $scope.test = function() {          $scope.out = $scope.array.map(x => x.name).join(', ');            }  }])
<script src="//code.angularjs.org/snapshot/angular.min.js"></script>    <div ng-app='app' ng-controller="ctrl">    <input type='text' ng-model='search' ng-init='search = "a"'/>    <ul>       <li ng-repeat='item in items | filter: search array'>{{item}}</li>    </ul>    <input type='button' ng-click='test()' value='test'/>     <hr/>    {{out}}  </div>


Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -