我有select
我正在填写controller
。或者至少应该这样做。
我一直在尝试这个
<select class="form-control selectWidth"
required
ng-model="template.type"
ng-init="template.type = template.type || types[0]"
ng-options="type.name as type.name for type in types">
<option style="display:none" value="" disabled>select a type</option>
</select>
来自我的控制器的$scope.types
$scope.types = [
{ title:'cities', type:'city', templates: []},
{ title:'buildings', type:'building', templates: []}
];
select会添加项目,但名称不会显示。
答案 0 :(得分:1)
我想你要改变
type.name as type.name for type in type
与
type.title as type.title for type in type
或者
type.type as type.type for type in type
取决于您要显示的内容