sistargirl 发表于 2016-5-6 10:49:49

急,如何动态设置ng-model?

我的select是动态读出来的,请问如何动态添加ng-model呢

你懂的 发表于 2016-5-6 14:06:54

<div ng-controller="TestCtrl">
<select ng-change="change(x)" ng-model="x">
    <option value="1">1</option>
    <option value="2">2</option>
    <option value="3">3</option>
</select>
</div>


var app = angular.module('Demo', [], angular.noop);

app.controller('TestCtrl', function($scope){
$scope.change = function(x){
    console.log(x);
}
});

angular.bootstrap(document, ['Demo']);
页: [1]
查看完整版本: 急,如何动态设置ng-model?