2
在下面,我检索一个对象列表,从中创建一个复选框列表。根据IsActive(布尔)列值,可以选中或不选中。在角JS中的复选框列表中双向绑定JS
<div class="col-xs-12">
<div class="col-xs-12" ng-repeat="x in Nodes" ng-model="Locations">
<input type="checkbox" style="width:auto" ng-checked="x.IsActive"/>
<label style="width:auto">{{x.NodeName}}</label>
</div>
</div>
这里是我提取节点列表中的对象的函数。
$scope.GetNodes = function() {
var nodeUrl = baseUrl + 'api/RoleNodeAccess/GetRoleNodeAccessDetails/?roleId=' + $scope.role;
$http({ method: 'get', url: nodeUrl }).then(function success(response) {
$scope.Nodes = response.data;
}, function failed(response) {
console.log('Failed getting nodes.');
})
}
这里的问题是,只要复选框的状态发生变化,它就不会反映在节点列表中。我错过了什么。
在此先感谢。
仍无法正常工作,节点列表保持不变,因为它是。 – Skye
@Skye我改变了我的答案一点,现在它的作品。我测试了它。 –
是的,它现在有效。日Thnx – Skye