多發性複選框值的值來獲得:如何用我的html頁面angularjs
<body ng-app>
<div class="wrapper wrapper-content" ng-controller="InboxMailCtrl">
<tr ng-repeat="CU in InboxList">
<td class="check-mail">
<input type="checkbox" ng-model="CU.Selected" value="{{CU.InboxMailID}}" class="i-checks" >
</td>
<td class="text-right mail-date">{{CU.time}}</td>
</tr>
<button ng-click="Delete()"></button>
</div>
</body>
,並在我的js文件:
var InboxMailCtrl = function ($scope, $http) {
BindInboxList();
function BindInboxList() {
$http({
url: "MailRoute/getDataForMailInbox",
dataType: 'json',
method: 'POST',
data: obj,
headers: {
"Content-Type": "application/json"
}
}).success(function (response) {
debugger;
$scope.InboxList = response;
}).error(function (error) {
alert(error);
});
}
$scope.Delete = function() {
debugger
$scope.MailNameArray = [];
angular.forEach($scope.InboxList, function (CU) {
if (!!CU.selected) $scope.MailNameArray .push(CU.InboxMailID);
})
}
$scope.Delete
被選中ckeckbox項目價值MailNameArray
,但我不能夠將選中的複選框數據推送到這個數組中。
出了什麼問題?
我使用的是webAPI控制器,而getDataForMailInbox
是api控制器中的一個函數。
,你可以把它放在一個小提琴或其他事端,所以我們可以看到到底發生了什麼,應該發生.... – MrBuggy