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?
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>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.