I have a element , which I would like to bind with a model to get/set the value and to populate it from a list using angular 1
The way I have it, I am able to bind it from UI to model, not vice versa, what am I doing wrong?
HTML:
<div ng-controller="MyCtrl">
<select class="form-control"
ng-options="o as o.prop for o in brands"
ng-model="selectedBrands"
multiple="multiple"
>
</select>
</div>
JS:
var myApp = angular.module('myApp', []);
function MyCtrl($scope) {
$scope.brands = [{
prop: 1
}, {
prop: 2
}, {
prop: 3
}];
$scope.selectedBrands = [{
prop: 2
}];
}
JSFiddle: