forked from alexklibisz/angular-dual-multiselect-directive
-
Notifications
You must be signed in to change notification settings - Fork 0
/
dualmultiselect.min.js
1 lines (1 loc) · 1.62 KB
/
dualmultiselect.min.js
1
/*Created by Alex Klibisz, [email protected] 2015*/var a;a=angular.module("dualmultiselect", []), a.directive("dualmultiselect", [function(){return{restrict: 'E',scope:{options: '='},controller: function($scope){$scope.transfer=function(from, to, index){if (index >=0){to.push(from[index]);from.splice(index, 1);}else{for (var i=0; i < from.length; i++){to.push(from[i]);}from.length=0;}};},template: '<div class="dualmultiselect"> <div class="row"> <div class="col-lg-12 col-md-12 col-sm-12"> <h4>{{options.title}}<small> {{options.helpMessage}}</small> </h4> <input class="form-control" placeholder="{{options.filterPlaceHolder}}" ng-model="searchTerm"> </div></div><div class="row"> <div class="col-lg-6 col-md-6 col-sm-6"> <label>{{options.labelAll}}</label> <button class="btn btn-default btn-xs" ng-click="transfer(options.items, options.selectedItems, -1)"> Select All </button> <div class="pool"> <ul> <li ng-repeat="item in options.items | filter: searchTerm | orderBy: options.orderProperty"> <a href="" ng-click="transfer(options.items, options.selectedItems, options.items.indexOf(item))">{{item.name}} ⇒ </a> </li></ul> </div></div><div class="col-lg-6 col-md-6 col-sm-6"> <label>{{options.labelSelected}}</label> <button class="btn btn-default btn-xs" ng-click="transfer(options.selectedItems, options.items, -1)"> Deselect All </button> <div class="pool"> <ul> <li ng-repeat="item in options.selectedItems | orderBy: options.orderProperty"> <a href="" ng-click="transfer(options.selectedItems, options.items, options.selectedItems.indexOf(item))"> ⇐ {{item.name}}</a> </li></ul> </div></div></div></div>'};}]);