美文网首页
ng-repeat 和select

ng-repeat 和select

作者: 咬了一口的苹果灬 | 来源:发表于2017-06-26 11:51 被阅读7次

两种写法

<select>
        <option value="x.id" ng-repeat="x in list" ng-bind="x.name">
        </option>
</select>
<select ng-options="x.id as x.name for x in list" ng-model="listId">
</select>

其中options分别对应value和bing
只有一个属性的时候可以 x.id as x.id

相关文章

网友评论

      本文标题:ng-repeat 和select

      本文链接:https://www.haomeiwen.com/subject/ewgdcxtx.html