简体   繁体   中英

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:

在此处输入图片说明

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM