我有我的angularjs视图,我必须填充我的选择框保存在数据库中的值,并允许选择其他选项。我尝试过这样:选择 - 编辑帖子时填充
<div class="form-group">
<label class="control-label" for="status">Status zaposlenika</label>
<div class="controls">
<select required name="status" class="form-control" ng-model="employee.status" ng-options="statusType.name for statusType in statusTypes" >
</select>
</div>
但我的价值没有填充我的看法。 ({{employee.status}} - >“test”)
$scope.statusTypes = [
{
name: 'test'
},
{
name:'Test1'
},
{
name: 'Test2'
},
{
name:'Test3'
}
];
我该怎么做?
编辑
我的模型employee.status填充了值 “测试”。但我的选择框不是。其他值被列为选择项目。如何设置保存在我的数据库中的默认值,以便在我的选择框中预先选择。
你不必在你'statusTypes'值'test',所以它不能被选择。 – dfsq 2014-11-03 12:40:23
模型employee.status填充从数据库获取数据使用服务和$ resorce – Sysrq147 2014-11-03 12:40:46
哦,很抱歉,价值是我的坏。但那不起作用。 – Sysrq147 2014-11-03 12:41:47