<select name="our_cal_type" ng-init="our_cal_type='P'" ng-model="our_cal_type">
<option value="R">Rs</option>
<option value="P">%</option>
</select>
ng-init : if our_cal_type is then in the option elements an option tag where value is P. Its automatically selected..
<div ng-app="testApp">
<div ng-controller="MainCtrl">
<select>
<option ng-repeat="rate in rates track by $index" ng-selected="{{rate.name=='pound'}}">
{{rate.name}}
</option>
</select>
</div>
</div>
var app = angular.module("testApp", []);
app.controller("MainCtrl", function($scope){
$scope.rates = [
{ 'name': 'dolar', 'is_default': true},
{ 'name': 'pound', 'is_default': false},
{ 'name': 'euro', 'is_default': true}
];
});
<option value="R">Rs</option>
<option value="P">%</option>
</select>
ng-init : if our_cal_type is then in the option elements an option tag where value is P. Its automatically selected..
or
<div ng-app="testApp">
<div ng-controller="MainCtrl">
<select>
<option ng-repeat="rate in rates track by $index" ng-selected="{{rate.name=='pound'}}">
{{rate.name}}
</option>
</select>
</div>
</div>
var app = angular.module("testApp", []);
app.controller("MainCtrl", function($scope){
$scope.rates = [
{ 'name': 'dolar', 'is_default': true},
{ 'name': 'pound', 'is_default': false},
{ 'name': 'euro', 'is_default': true}
];
});
0 comments:
Post a Comment