angularjs-dropdown-multiselect angularjs

时间:2016-05-12 15:04:45

标签: angularjs angular-ui-bootstrap

我有一个下拉式多选。该指令使用Bootstrap的Dropdown和AngularJS指令和绑定的强大功能。我是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”。如何选择第一个复选框?

1 个答案:

答案 0 :(得分: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"}];
    }]);