【发布时间】:2017-03-16 01:44:38
【问题描述】:
这里有类似的问题,但我仍然无法弄清楚我做错了什么。我有 ng-options 在表单中填充标签。在表单的提交控制器中,当我 console.log ng-model 时它返回未定义。如有任何帮助,我将不胜感激。
<label ng-controller="educationController">
select your level of education
<select ng-model="selectedEducation" ng-options="education for education in degrees" required>
</select>
</label>
这是控制器
angular.module('drsApp.reviewerApplication');
app.controller('educationController', educationController)
function educationController($scope){
$scope.degrees=[
"Bachelor Degree",
"Master Degree",
"Doctorate Degree"
]
};
这是在表单的控制器中
console.log("education: "+ $scope.selectedEducation);
【问题讨论】:
标签: angularjs-ng-model angularjs-ng-options