【发布时间】:2014-09-25 18:19:38
【问题描述】:
我正在尝试在我的 Angular 应用程序中添加功能,以记录复选框被单击时的顺序,从而以与单击时相同的顺序显示它们。
这里是sn-p:
var app = angular.module('checkbox', []);
app.controller('homeCtrl', function ($scope) {
$scope.array = [1, 5];
$scope.array_ = angular.copy($scope.array);
$scope.list = [{
"id": 1,
"value": "apple",
}, {
"id": 3,
"value": "orange",
}, {
"id": 5,
"value": "pear"
}];
$scope.update = function () {
if ($scope.array.toString() !== $scope.array_.toString()) {
return "Changed";
} else {
return "Not Changed";
}
};
})
});
在这个 sn-p 数组中应该按点击顺序显示数字。
【问题讨论】:
标签: angularjs angularjs-scope angularjs-ng-repeat angular-ui