Issue
want to display json data according to the parameter which is catch by state params but problem is that array does not show any thing , me using the underscore lib , kindly check the controller and tell me where the problem or any alternative way to do it ..
.controller('abCtrl',function($scope,$http,$stateParams) {
$http.get("http://tools.vcommission.com/api/coupons.php?apikey=<private_key>").then(function (response) {
$scope.filteredOffers = [];
var offerName = $stateParams.offer_name;
$scope.filteredOffers = _.filter(response.data, ["offer_name",offerName]);
console.log($scope.filteredOffers)
console.log(offerName)
})
})
Solution
Your filter should be,
$scope.filteredOffers = $filter('filter')(response.data, {offer_name: offerName});
also inject $filter to your controller,
.controller('abCtrl',function($scope,$http,$stateParams,$filter) {
Answered By - Sajeetharan
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.