Reputation: 8648
I have the following code:
<select ng-model="model.RemediationCredentials" name="remediationCredential" id="remediationCredential">
<option value="0">---</option>
<option ng:repeat="cred in credentialsList"
data-index="{{$index}}" value="{{cred.Value}}">{{cred.Key}}</option>
</select>
and credentialsList
looks like:
credentialsList = [ { Key: "Panda", Value: "Zoo: } ]
I think I need to use ng-repeat
vs ng-option
to do some basic things like the no selection and do the data-index
. However, when I try to set the model it doesn't work...
$scope.model.RemediationCredentials = "Zoo"
Any suggestions?
Upvotes: 2
Views: 10200
Reputation: 69
use the Angular Select Directive:
http://docs.angularjs.org/api/ng.directive:select
Should look something more like this:
<select ng-model="model.RemediationCredentials" name="remediationCredential" id="remediationCredential" ng-options="cred.value as cred.key for cred in credentialsList">
<option value="0">---</option>
</select>
Upvotes: 4