0

I have a variable defined in a controller that stores json values:

$rootScope.fullList;  

I have been able to successfully filter the results using a filter I found to return only exact matches to a keyword and display the results on my page. I need to store these filtered values into a new variable.

$scope.filteredList = $rootScope.fullList| exactMatch:'STATUS';  

Something like this.

C1pher
  • 1,933
  • 6
  • 33
  • 52

1 Answers1

0

I would use _filter: LINK

like:

   $scope.filteredList = _.filter($scope.fullList, function(item) {
      return !(nodeClient.name == 'STATUS');
     });      

as a side note

How _filter works:

filter_.filter(list, iterator, [context]) Alias: select
Looks through each value in the list, returning an array of all the values that pass a truth test (iterator). Delegates to the native filter method, if it exists.
var evens = _.filter([1, 2, 3, 4, 5, 6], function(num){ return num % 2 == 0; });
=> [2, 4, 6]

Actually _filter has list of options that might help you in the future as well

Maxim Shoustin
  • 77,483
  • 27
  • 203
  • 225
  • This was interesting reading, but I achieved the result I was looking for by storing the value for my filter as a variable in $scope and changing the value based on user interaction. – C1pher Oct 29 '13 at 18:50