<select ng-model="t" **ng-select="$first"**>
<option ng-repeat="t in tees"
value="{{ t }}">
{{ t.name }}
</option>
</select>
有类似 ng-select="$first" 的东西吗?
(P.s.别想t,没关系,不是t.value)
最佳答案
你可以像这样简单地使用 ng-init :
<select ng-model="t" ng-init="t=tees[0]">
<option ng-repeat="t in tees"
value="{{ t }}">
{{ t.name }}
</option>
</select>
关于javascript - 如何在 Angular 中选择动态填充/未填充的 Selectbox 的第一个元素?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34271978/