Search Posts

Category: ng-options

How to bind selected option value in ng-options to a value of object in the controller?

I have some troubles while trying to update the current selected value of an option in ng-options.I have an array which contains one object. The object has ‘value’ and ‘name’ properties whose values are constant. I am using this constant array in a custom directive with select and ng-options. This is part of the directive’s html: <select name=”{{vm.name}}” ng-model=”vm.model” ng-options=”arrayObject.value as arrayObject.name for arrayObject in vm.constantArrayofObject”> </select> And I use this directive in a form […]