Hi, I’m in the process of creating a “user setting view” and need some help. At the moment my code lists out Car and Motorbike with correct Choices but I’m struggling to get the “default” option to work.
Any suggestions on what I’m doing wrong?
Controller:
.controller('FavoritsCtrl', function($scope,) {
$scope.options = [
{name: 'Car',
Choices: [
{id:0, name:'Nissan'},
{id:1, name: 'Bmw'},
{id:2, name: 'Volvo'}
],
default: {id:1, name: 'Bmw'}
},
{name: 'Motorbike',
Choices: [
{id:0, name:'Ducati'},
{id:1, name: 'Kawasaki'},
{id:3, name: 'Yamaha'}
],
default: {id:0, name:'Ducati'}
},
];
})
View:
<ion-list ng-repeat="item in options">
<ion-item class="item item-input item-select">
<div class="input-label">
{{item.name}}
</div>
<select ng-model="item.default" ng-options="item.name for item in item.Choices">
</select>
</ion-item>
</ion-list>