0
我發現所選模型只包含選項對象屬性的id屬性。所選模型是否可能包含整個對象?如何將整個select選項對象設置爲模型?
HTML
<div ng-dropdown-multiselect="" options="exampleData" selected-model="exampleModel"></div>
的JavaScript
$scope.exampleModel = [];
$scope.exampleData = [
{id: 1, code: 'CA': label: "California"},
{id: 2, code: 'MN' label: "Minnesota"},
{id: 3, code: 'NY', label: "New York"} ];
因此,在這種情況下,如果我選擇第一個選項,模型變爲:
$scope.exampleModel = [{"id":"CA"}]
我需要的型號包含整個選項對象如下:
$scope.exampleModel = [{id: 1, code: 'CA': label: "California"}]