这是代码AngularJS:
var app = angular.module('myApp',[]);
app.controller('SelectCtrl',function($scope) {
$scope.items = [{name: 'one',age: 30 },{ name: 'two',age: 27 },{ name: 'three',age: 50 }];
$scope.selectedItem = $scope.items[0];
console.log($scope.selectedItem); //it's not update :(
});
在视图中,每次更改选择时都会更新新值,但控制器不会更新选择的当前值.我该怎么办?
谢谢!
最佳答案
原文链接:https://www.f2er.com/html/426896.html