用ng-click单击复选框不会更新模型
单击复选框并调用ng-click:在ng-click插入之前不会更新模型,因此在UI中错误地显示了复选框的值: 这在AngularJS 1.0.7中有效,在Angualar 1.2-RCx中似乎已损坏。 <div ng-app="myApp" ng-controller="Ctrl"> <li ng-repeat="todo in todos"> <input type='checkbox' ng-click='onCompleteTodo(todo)' ng-model="todo.done"> {{todo.text}} </li> <hr> task: {{todoText}} <hr><h2>Wrong value</h2> done: {{doneAfterClick}} 和控制器: angular.module('myApp', []) .controller('Ctrl', ['$scope', function($scope) { $scope.todos=[ {'text': "get milk", 'done': true }, {'text': "get milk2", 'done': false } ]; $scope.onCompleteTodo = function(todo) { console.log("onCompleteTodo …