Currently, I am working on developing a stacked graph along with its associated table. To retrieve the necessary JSON data, I am utilizing $http.get()
and then assigning it to $scope.dataset
.
Here's a snippet of the HTML:
<input ng-model="_searchQuery.key1.key2">
<tr ng-repeat="(key, value) in dataset | filter:_searchQuery ">
My main query is regarding updating $scope.dataset
within the controller?
The _searchQuery
effectively filters the dataset
, seamlessly altering my table. This means no additional coding is required in the controller. Essentially, dataset.key1.key2
corresponds to _searchQuery.key1.key2
However, when it comes to working with the nvd3.js stacked graphs, I found myself needing to apply similar filtering to $scope.dataset
directly in the DOM. Attempting
$scope.dataset = $filter('$scope._searchQuery.key1.key2')($scope.dataset)
resulted in an error. My approach mimics that of Angular documentation as well as insights from this source: How to use a filter in a controller?