2017-05-08 10 views
0

私は角度が新しく、角のjs-dropdown-multi選択モジュールをHEREから使用しています。anglejsの最初のドロップダウンで2番目のドロップダウンマルチセレクションを塗りつぶす

最初のドロップダウン選択に基づいて2番目のドロップダウンを入力しようとしていますが、私がここで直面している最初の問題は、選択したアイテムがすべて選択されていて、 [Object object]を参照してください。それはどういう意味ですか?

ご迷惑をおかけして申し訳ありません。

Plunker Demo

HTML:

<div ng-dropdown-multiselect="" 
    options="example14data" 
    events="eventSettings" 
    selected-model="example14model" 
    extra-settings="example14settings"> 
</div> 

<div ng-dropdown-multiselect="" 
    options="example15data" 
    selected-model="example15model" 
    extra-settings="example15settings"> 
</div> 

はJavaScript

var app = angular.module('plunker', ['angularjs-dropdown-multiselect']); 

app.controller('MainCtrl', function($scope) { 
    $scope.name = 'World'; 

    $scope.example14model = []; 
    $scope.example14settings = { 
     scrollable: true, 
     enableSearch: true, 
     displayProp: 'type1' 
    }; 

    $scope.eventSettings={ 
    onItemSelect: function (item) { 
     console.log('selected: '+item); 
      } 
    } 

    $scope.example14data = [ 
     { 
     "type1":"A", 
     "servers":[ 
      { 
      "type2":"a" 
      }, 
      { 
      "type2":"b" 
      }, 
      { 
      "type2":"c" 
      } 
      ] 
     }, 
     { 
     "type1":"B", 
     "servers":[ 
      { 
      "type2":"d" 
      }, 
      { 
      "type2":"e" 
      }, 
      { 
      "type2":"f" 
      } 
      ] 
     }, 
     { 
     "type1":"C", 
     "servers":[ 
      { 
      "type2":"g" 
      }, 
      { 
      "type2":"h" 
      }, 
      { 
      "type2":"i" 
      } 
      ] 
     }, 
     ]; 


    $scope.example15model = []; 
    $scope.example15settings = { 
     scrollableHeight: '200px', 
     scrollable: true, 
     enableSearch: true, 
     selectionLimit:1, 
     displayProp: 'id' 
    }; 

    $scope.example15data = []; 

    $scope.example3settings = { 

    }; 

}); 
+0

の値が表示されます[Object object]

を見ている理由である文字列を連結していることはplunkですhttps://plnkr.co/edit/dzWCuepCWtBCJvnfFPx7?p = preview – Praveen

+0

これは正確に何が行われるのですか?今すぐ最初のドロップダウンは正しく機能していないようです。つまり、 'b'を選択すると、' 1チェックされた 'としか言わなくても、すべてのチェックに 'a'、' b'、*、 '' c''が行われます。チェックの倍数は可能ではありません。 – Claies

答えて

1

AngularJSドロップダウン複数選択は、データの一意のIDが何であるかを知っているように、あなたはidProp設定を設定する必要があります。

$scope.example14settings = { 
    scrollable: true, 
    enableSearch: true, 
    displayProp: 'type1', 
    idProp: 'type1', 
}; 

は商品の変数と次のコードは、項目ここ

$scope.eventSettings={ 
    onItemSelect: function (item) { 
    console.log('Selected:'); 
    console.log(item); 
    } 
} 
関連する問題