昨天好人帮我把一个页面的参数从一个页面传递到另一个离子/角度,但现在问题是,当我传递参数时,它包含%符号。
EG。看起来像http://localhost:8100/#/Deals/Paytm.com%20CPS%20-%20India 我想在这里展示http://localhost:8100/#/Deals/Paytm.com CPS - 印度。
我希望通过它显示显示数据。我如何存档并显示数据。
以下是我们的代码..
<div class="item col-sm-2 col-sm-3 col-md-2 " ng-repeat="da in myData | unique: 'store_image'" >
<div class="thumbnail " >
<img class="thumbnail img-responsive " ng-src="{{ da.store_image}}"
ng-click="showData(da.offer_name, $index)"
/>
<div class="caption">
<b class="group inner list-group-item-heading center-block">
{{da.offer_name | limitTo: 12 }} Deals </b>
<a class="item item-text-wrap" ng-href="#/Deals/{{da.offer_name }}">View Deal</a>
</div>
</div>
</div>
</div>
Angular js
.controller('menuCtrl', function($scope,$http) {
$http.get("http://tools.vcommission.com/api/coupons.php?apikey=e159f64e3dd49fddc3bb21dcda70f10c6670ea91aac30c7cb1d4ed37b20c45b8").then(function (response) {
$scope.myData = response.data;
$scope.offerName = ''; //set initially
$scope.selectedIndex = -1;
$scope.filteredOffers = [];
});
$scope.showData = function(offer_name, index) {
$scope.offerName = offer_name;
$scope.filteredOffers = $scope.myData.filter(function(offer) {
return offer.offer_name == $scope.offerName;
});
$scope.selectedIndex = index;
}
})
优惠页面
<div ng-repeat="offer in filteredOffers">
<div class="couponCode">{{offer.coupon_code}}</div>
<div class="couponTitle">{{offer.coupon_title}}</div>
<div class="couponDescription">{{offer.coupon_Description}}</div>
</div>
</ion-content>
最后
路线
.state('Deals', {
url: '/Deals/:offer_name',
templateUrl: 'temp/deal.html',
controller: 'menuCtrl'
})
如何从url参数
获取数据