[英]How to create a rating component with stars (filled or unfilled) on React js?
[英]How to select the first element of dynamically filled/unfilled Selectbox in Angular?
<select ng-model="t" **ng-select="$first"**>
<option ng-repeat="t in tees"
value="{{ t }}">
{{ t.name }}
</option>
</select>
是否有類似ng-select =“ $ first”的東西 ?
(P不用考慮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>
我發現以下代碼在視圖中不太冗長:
<select ng-model="t" ng-options="t.value as t.name for t in tees></select>
然后在您的控制器中:
$scope.t = $scope.tees[0].value
希望能幫助到你
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.