2016-07-04 28 views
1

デュアルボックスで選択した値を取得しようとしています。bs dual listの選択ボックスから値を取得する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を私はコードスニペット以下のようなものを行っている。このリンクhttp://www.virtuosoft.eu/code/bootstrap-duallistbox/

のrefferenceと

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

私はこれだけを取得しています:私はここにIDまたはrecSchedulingNameを表示する必要が

["object:326"] 

+0

角度のあるブートストラップまたはカスタムブートストラップ+角度? –

+0

角を持つbs – MonsterJava

答えて

1

あなたが書いたコードconsole.log($('[name="duallistbox_demo1[]"]').val());はノードjsコードです。これは血管には適合しません。

オブジェクトng-model = "recSchedule"から取得できるすべてのデータ。このオブジェクトをforeachに入れて、値を見ることができます。

関連する問題