daily pastebin goal
12%
SHARE
TWEET

Untitled

a guest Dec 13th, 2017 63 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. vm.selected=[];
  2.  
  3.     vm.items=['Lunes','Martes','Miércoles','Jueves','Viernes','Sábado','Domingo'];
  4.  
  5.     vm.exists = function (item, list) {
  6.         return list.indexOf(item) > -1;
  7.     };
  8.  
  9.     vm.toggle = function (item, list) {
  10.         var idx = list.indexOf(item);
  11.         if (idx > -1) {
  12.             list.splice(idx, 1);
  13.         }
  14.         else {
  15.             list.push(item);
  16.         }
  17.     };
  18.  
  19.     vm.isIndeterminate = function() {
  20.         return (vm.selected.length !== 0 &&
  21.                 vm.selected.length !== vm.items.length);
  22.     };
  23.  
  24.     vm.isChecked = function() {
  25.         return vm.selected.length === vm.items.length;
  26.     };
  27.  
  28.     vm.toggleAll = function() {
  29.         if (vm.selected.length === vm.items.length) {
  30.             vm.selected = [];
  31.         } else if (vm.selected.length === 0 || vm.selected.length > 0) {
  32.             vm.selected = vm.items.slice(0);
  33.         }
  34.     };
RAW Paste Data
Top