我有这个 html
<div class="row " style="margin-left:75pt;">
<div class="dropdown">
<label class="text-center" style="margin-top:10pt;font-size:14pt;"> Deals on</label>
<button data-toggle="dropdown" class=" btn dropdown-toggle dropdown-menu-hover-color text-center" style="padding:0px 0px;background-color:white;" href="#"><label style="font-size:14pt; color: #191970;" >{{currentCategory}}</label> <b class="caret"></b></button>
<ul class="dropdown-menu submenu-hover-color" style="margin:0;">
<li><a href="#" id="{{page.category_id}}" ng-click="changeCategory(page.category_id);" ng-repeat="page in dropdownCategoryList" ng-model="category_id">{{page.category_name}}</a></li>
</ul>
</div>
</div>
Angularjs 控制器中的这段代码。
$scope.changeCategory = function(category_id) {
$window.alert(category_id);
$http({
method : 'POST',
url : '/changeCategory',
data : category_id,
headers : { 'Content-Type': 'application/x-www-form-urlencoded' }
// set the headers so angular passing info as form data (not request payload)
}).success(function(data, status, headers, config) {
}).error(function(data, status, headers, config) {
$scope.status = status;
$window.alert("error")
});
}
我想在后端访问Golang中AngularJS中控制器函数的category_id参数,那么我应该在http的数据字段中传递什么。
aluckdog
相关分类