<select id="marketSelect" ng-model="market" name="marketSelect" ng-change="update()" ng-options=" market.Label group by market.FYear for market in markets" class="form-control">
</select>
標識和標籤存儲在$cookieStore
中。我試圖通過使用控制器如何在angularjs的select選項中設置默認值?
$scope.market = $cookie.get('marketID');
的代碼來設置默認值,但它不工作,我已經試過ng-init
也。
http://stackoverflow.com/questions/17329495/how-to-use-ng-option-to-set-default-value-of-select-element –