发现个奇怪的事,angualr的select标签ng-model更新不到值?

就是option改了之后,我在控制器里用$scope.name取不到值,好奇怪

<select ng-model="name"> <option ng-repeat="item in items" ng-value="item"></option>
</select>

https://code.angularjs.org/1….

<select name="mySelect" id="mySelect" ng-options="option.name for option in data.availableOptions track by option.id" ng-model="data.selectedOption"></select>

http://codepen.io/hj624608494…

<select ng-model="name" ng-change="showName"> <option ng-repeat="item in items" ng-value="item" ng-bind="item"></option>
</select>
app.controllermyCtrl, function$scope { $scope.name = 1; $scope.items=[1,2,3]; $scope.showName=function{ console.log$scope.name; }
};

发表评论

电子邮件地址不会被公开。 必填项已用*标注