我试图使用ng-materials ui-components中的md-input和md-option元素。
作为ng-materials对象,它不起作用:
<md-input-container>
<md-select ng-model="forcast.selectedCompound">
<md-option ng-value="compound._id" ng-repeat="compound in forcast.compounds" >
{{compound.compound_number}}
</md-option>
</md-select>
</md-input-container>
使用常规的html 5组件确实有效:
<md-input-container>
<select ng-model="forcast.selectedCompound">
<option value="{{compound._id}}" ng-repeat="compound in forcast.compounds" >
{{compound.compound_number}}
</option>
</select>
</md-input-container>
因为html5元素有用,我确信我的ng-materials标记有问题?
答案 0 :(得分:1)
您应该使用value
中的md-option
属性而不是ng-value
{{ }}
。查看select的官方文档。
<md-input-container>
<md-select ng-model="forcast.selectedCompound">
<md-option value="{{compound._id}}" ng-repeat="compound in forcast.compounds" >
{{compound.compound_number}}
</md-option>
</md-select>