2016-07-04 55 views
1

我試圖在雙框中獲取選定的值。 與該鏈路REFFERENCE http://www.virtuosoft.eu/code/bootstrap-duallistbox/從bs雙列表中的選定框中獲取值angularJS

我已經做了類似下面的代碼片段:

的.html

<select name="duallistbox_demo1[]" 
         ng-model="recSchedule" 

         ng-options="recSchedule as recSchedule.recSchedulingName for recSchedule in recordingSchedules" 
         size="10" 
         multiple 
         bs-duallistbox 
         selected-list-label="{{ settings.selectedListLabel }}" 
         non-selected-list-label="{{ settings.nonSelectedListLabel }}"> 
       </select> 

JSON文件:

[ 

    { 
     "id": "1",   
     "recSchedulingName": "Record Schedule 1" 
    }, 
    { 
     "id": "2", 
     "recSchedulingName": "Record Schedule 2" 
    }, 
    { 
     "id": "3", 
     "recSchedulingName": "Record Schedule 3" 
    } 
] 

的.js

console.log($('[name="duallistbox_demo1[]"]').val()); 

我得到僅此:

["object:326"] 

我需要顯示的ID或recSchedulingName這裏。

+0

引導與角度或自定義引導+角? –

+0

帶棱角的bs – MonsterJava

回答

1

你寫的代碼console.log($('[name="duallistbox_demo1[]"]').val());是一個節點js代碼。這與angualrjS不兼容。所有可從對象ng-model =「recSchedule」中獲得的數據。你可以把這個對象放在foreach中,看看這些值。

相關問題