$http({method: 'GET', url: '/asas/asasa'}).success(function(data) {
$scope.website = data.websites;
$scope.topoffer = data.coupons;
$scope.webcall = function () {
$http({method: 'GET',url: '/asas/asas?websiteId='+data.website.websiteId}).success(function(data) {
$scope.onlinedata = data.coupons;
});
};
});
我的html文件 -
<div class="check_box" ng-repeat="web in topoffer">
<label ng-click="webcall()"for="{{web}}"><input type="checkbox" id="{{web.websiteId}}" />{{web.websitename}}</label>
</div>
当某些点击标签需要在我的onclick函数url中传递该id时。我正在使用角度js 1.2.17
我的json文件
"websites":[{
"websiteName":"Flipkart",
"websiteId":"1",
},
{
"websiteName":"asas",
"websiteId":"5",
}]
答案 0 :(得分:1)
您无法通过web
中的通话传递ng-click
个对象吗? e.g:
<div class="check_box" ng-repeat="web in topoffer">
<label ng-click="webcall(web)"for="{{web}}"><input type="checkbox" id="{{web.websiteId}}" />{{web.websitename}}</label>
</div>
在控制器中:
$scope.webcall = function(web) {
$http({method: 'GET',url: '/asas/asas?websiteId='+web.websiteId}).success(function(data) {
$scope.onlinedata = data.coupons;
});
};
答案 1 :(得分:0)
尝试:
$http({method: 'GET',url: '/asas/asas', params: { websiteId:data.website.websiteId })