显示json数据的参数param参数

时间:2017-02-04 07:51:42

标签: angularjs json ionic-framework

想要根据状态参数捕获的参数显示json数据但是问题是数组没有显示任何东西,我使用下划线lib,请检查控制器并告诉我问题的位置或任何替代方法做它..

.controller('abCtrl',function($scope,$http,$stateParams) {


$http.get("http://tools.vcommission.com/api/coupons.php?apikey=e159f64e3dd49fddc3bb21dcda70f10c6670ea91aac30c7cb1d4ed37b20c45b8").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)
      })


})

1 个答案:

答案 0 :(得分:0)

您的过滤器应为,

$scope.filteredOffers = $filter('filter')(response.data, {offer_name: offerName});

还会向控制器注入$ filter,

.controller('abCtrl',function($scope,$http,$stateParams,$filter) {