Bonyjose Bonyjose -4 years ago 257
Javascript Question

multiselectable dropdown checkboxes using angular js

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 template refreshes each time I click on a checkbox,please suggest some ideas?

{ <ul class="status-select" class="status-select" ng-if="$index == selectedFilterIndex">
<li ng-repeat="DataValue in filter.Data.Value">
<input type="checkbox" ng-click="OnDropDownSelectionChanged(filter,DataValue)">

Answer Source

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;
<script src=""></script>
<link href="" rel="stylesheet" />
<script src=""></script>
<link href="" rel="stylesheet" />
<script src=""></script>

    Example of sytled angularjs-dropdown-multiselect  

<a href="">Source documentation</a>

<div ng-app="exampleApp" ng-controller="appController">

  <div ng-dropdown-multiselect="" options="example13data" selected-model="example13model" extra-settings="example13settings"></div>


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download