2016-05-12 84 views
0

我有一個dropdown-multiselect。該指令使用Bootstrap的Dropdown,具有AngularJS指令和綁定的強大功能。我新來angularjs。angularjs-dropdown-multiselect angularjs

<li id="bedsLists"> 
    <div ng-dropdown-multiselect="" 
     options="beds" 
     selected-model="selectedBeds" 
     checkboxes="true" 
     events="{onItemSelect: onItemSelect, onItemDeselect: onItemDeselect}" 
     extra-settings="{showCheckAll: false, showUncheckAll: false, dynamicTitle: false, externalIdProp: 'Value', displayProp: 'Name', idProp: 'Value'}" 
     translation-texts="{buttonDefaultText: 'Beds'}"> 
    </div> 
</li> 

從stateParams獲取所需值,例如「1」。如何選擇第一個複選框?

回答

0

試試這個

在控制器

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

    myApp.controller('appController', ['$scope', function($scope) { 

    $scope.selectedBeds = [{id: 1, label: "David"}]; // add the 1st data of your 
    $scope.beds = [ 
     {id: 1, label: "David"}, 
     {id: 2, label: "Jhon"}, 
     {id: 3, label: "Lisa"}, 
     {id: 4, label: "Nicole"}, 
     {id: 5, label: "Danny"}]; 
    }]);