I ended up using
<select ng-model="record.nameChain" ng-options="x.name as x.name for x in chains">
Thanks to the people who suggested using options.
I ended up using
<select ng-model="record.nameChain" ng-options="x.name as x.name for x in chains">
Thanks to the people who suggested using options.
I have a select that is generated dynamically and I want one of the values to be selected by default. The value that is going to be selected depends on what record the user is editing.
I have the following code that isn’t currently working:
<select ng-model="record.chain" name="chain" class="form-control" ng-change="updateBrands(record.chain)">
<option ng-selected="{{ x.name == 'record.nameChain '}}" ng-repeat="x in chains" value="{{x.type}} {{x.name}}">{{x.name}}</option>
The ng-change
part is used to update another select.
Do you have an idea on how I can achieve this?
Thanks.
Try removing the quotes from
@charlietfl that disn’t work 🙁
OK…has been a long time since I used angularjs but some directives don’t use
No curly brackets required in ng-selected. Don’t use quotes Inside either around record.nameChain. Agree with others here.