0

I am using grails select dropdown element. I need to set default value for select2 dropdown options while click edit option in a form using angularjs..when i click edit button, then i have fetch related data for that form and update to form fields value as json object..Now normal text fields has been updated successfully.but select-2 dropdown fields doesn't updated to current value as selected.What's wrong with my code..here i have set common name for form model and object key like object key name and ng-model name are same for all datas..

Thanks advanced..

My Object for update to form fields:

Object {id: 3, name: "uday", code: "1", moveTaskType: "SPOT", priority: 1…}

My Form select2 Code:

 <g:select id="moveTaskType" name="moveTaskType" from="${com.aa.fsight.MoveTaskRuleDef.MoveTaskType.class.getEnumConstants().collect{[name:it.name(), type: it.type]}}" optionKey="name" optionValue="type" class="select2 multiSelect" noSelection="['':'None']" ng-model="taskCreateForm.moveTaskType" />

My Controller code for data updation:

$scope.taskCreateForm=data;

1 Answer 1

0

Why you don't use the select of angularjs ? You can bind the property directly with your tabs and choose your default selection.

Sign up to request clarification or add additional context in comments.

1 Comment

angualrjs have using now just migrate to angularjs..not pure angularjs..application has grails, with angularjs..so select option has used for some multi purpose..now i don;t like to change grails select option to angularjs select..i need to change like above code wise..

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.