Search Posts

Category: ng-options

Keeping Angularjs HTML Green

When I add ng-options to a select element, I get options that look like this: <select name=”folderId” data-ng-model=”message.folderId” data-ng-options=”folder.id as folder.name for folder in folders”> <option value=”” class=””>No Folder</option> <option label=”Bulk” value=”string:0fedcc77-4cc5-4a9a-ba2f-847f8581d4d7″ selected=”selected”>Bulk</option> <option label=”Auto Responder” value=”string:d0898116-88ce-4e25-8d91-b17a7a29adc1″>Auto Responder</option> <option label=”Customer Service” value=”string:6ec044c1-c378-42de-82ad-f3dc63c58f00″>Customer Service</option> </select> The problem with the above is that Angular is adding string: in front of the folder ID. This form is submitting data to a remote page when clicked. However, the string: […]

Angular adding <option value="?string:abc ?"></option>

When i try to change unusedEmailArray on select of dropdown options, Angular add <option value=”? string:work?”></option> in the HTML. <div ng-repeat=”email in emails” > <div> <select type=”text” id=”emailType” name=”email_type_{{$index}}” placeholder=”Type” ng-model=”email.email_type” ng-model-options=”{updateOn:’default blur’}” ng-change=”showChangesMade(email_type_{{$index}})” > <option value=”{{email.email_type}}” ng-selected=”email.email_type.length>0″>{{email.email_type}}</option> <option ng-repeat=”unusedArr in unusedEmailArray” value=”{{unusedArr}}”> {{unusedArr}} </option> </select> </div> Source: AngularJS

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 […]