Udaya Ravi
Udaya Ravi

Reputation: 197

how to set mutiple values for multi select2 tag element in grails <g:select using angularjs

i am trying to set multiple option value in tag in grails using angularjs. Here the initial select option has loaded through grails.actually here i have work in migrate to angularjs. I have mention code below.and also i am new to grails part..so i don't know how to use angularjs in grails..Can any one give ideas

My gsp select Tag:

<g:select id="fromLogicalDockGroupId" multiple="true"  name="fromLogicalDockGroupId" optionKey="id" optionValue="name" from="${dockGroups}" class="select2 multiSelect" ng-model="taskCreateForm.fromLogicalDockGroupId" />

Now apply selected value from controller

$scope.taskCreateForm=data;

data object value for apply to

fromLogicalDockGroupId: Array[2]
0: "2"
1: "1"
length: 2
__proto__: Array[0]

Expected Output:

enter image description here

Upvotes: 0

Views: 497

Answers (1)

Uday
Uday

Reputation: 629

It doesn't look like a grails specific problem, either you have to do it using angular or some javascript code will do it for you.

g:select takes the value as an argument which we will be shown selected.

Upvotes: 1

Related Questions