multiselectable dropdown checkboxes using angular js

后端 未结 3 1479
半阙折子戏
半阙折子戏 2020-12-16 17:05

I want to design a dropdownlist of checkboxes and make the checkboxes multi-selectable. I have used the below code,but I am unable to make multiple selections as the templat

3条回答
  •  半阙折子戏
    2020-12-16 17:50

    You can use directive like angularjs-dropdown-multiselect, which you can find very easily on internet

    Here are some example:

    1. angularjs-dropdown-multiselect - Fiddle

    2. multiselectDropdown - Fiddle

    3. Another example of angularjs-dropdown-multiselect - Fiddle

    Code Snippet:

    var myApp = angular.module('exampleApp', ['angularjs-dropdown-multiselect']);
    
    myApp.controller('appController', ['$scope',
      function($scope) {
    
        $scope.example13model = [];
        $scope.example13data = [{
          id: 1,
          label: "David"
        }, {
          id: 2,
          label: "Jhon"
        }, {
          id: 3,
          label: "Lisa"
        }, {
          id: 4,
          label: "Nicole"
        }, {
          id: 5,
          label: "Danny"
        }];
    
        $scope.example13settings = {
          smartButtonMaxItems: 3,
          smartButtonTextConverter: function(itemText, originalItem) {
            if (itemText === 'Jhon') {
              return 'Jhonny!';
            }
    
            return itemText;
          }
        };
      }
    ]);
    div, h1, a {
      padding: 5px;
    }
    
    
    
    
    
    

    Example of sytled angularjs-dropdown-multiselect

    Source documentation

提交回复
热议问题