【发布时间】:2015-10-28 20:12:27
【问题描述】:
我正在使用 Angular 编写一个下拉选择菜单,其中包含一些提交到数据库的选项。在前端html中:
Role Type:
<select ng-model = "Role_Type">
<option ng-repeat="role in roles" value="{{role}}"> {{role}} </option>
</select>
在我的控制器中,我有:
$scope.roles = ['Teacher', 'Student', 'Janitor', 'Principal'];
$scope.addNewEntry = function() {
entrys.addNewEntry({
Role_Type: $scope.role,
});
}
在我的后端(使用 Mongoose.js)架构中,我有:
var EntrySchema = new mongoose.Schema({
Role_Type: String,
});
我使用下面的代码在前端显示回来:
Role Type:
{{entry.Role_Type}}
但这不起作用。前端没有显示任何内容。有什么想法吗?
【问题讨论】:
标签: angularjs mongoose angularjs-ng-repeat schema mean-stack