examples/vendor/angular-selection-model/selection-model.js
function(event) {

          /**
           * Set by the `selectionModelIgnore` directive
           *
           * Use `selectionModelIgnore` to cause `selectionModel` to selectively
           * ignore clicks on elements. This is useful if you want to manually
           * change a selection when certain things are clicked.
           */
          if(event.selectionModelIgnore || (event.originalEvent && event.originalEvent.selectionModelIgnore)) {
            return;
          }

          // Never handle a single click twice.
          if(event.selectionModelClickHandled || (event.originalEvent && event.originalEvent.selectionModelClickHandled)) {
            return;
          }
          event.selectionModelClickHandled = true;
          if(event.originalEvent) {
            event.originalEvent.selectionModelClickHandled = true;
          }

          var isCtrlKeyDown = event.ctrlKey || event.metaKey || isModeAdditive
            , isShiftKeyDown = event.shiftKey
            , target = event.target || event.srcElement
            , isCheckboxClick = 'checkbox' === smType &&
                'INPUT' === target.tagName &&
                'checkbox' === target.type;

          /**
           * Guard against label + checkbox clicks
           *
           * Clicking a label will cause a click event to also be fired on the
           * associated input element. If that input is nearby (i.e. under the
           * selection model element) we'll suppress the click on the label to
           * avoid duplicate click events.
           */
          if('LABEL' === target.tagName) {
            var labelFor = angular.element(target).attr('for');
            if(labelFor) {
              var childInputs = element[0].getElementsByTagName('INPUT'), ix;
              for(ix = childInputs.length; ix--;) {
                if(childInputs[ix].id === labelFor) {
                  return;
                }
              }
            } else if(target.getElementsByTagName('INPUT').length) {
              // Label has a nested input element, we'll handle the click on
              // that element
              return;
            }
          }

          // Select multiple allows for ranges - use shift key
          if(isShiftKeyDown && isMultiMode && !isCheckboxClick) {
            // Use ctrl+shift for additive ranges
            if(!isCtrlKeyDown) {
              scope.$apply(function() {
                deselectAllItemsExcept([smItem, selectionStack.peek(clickStackId)]);
              });
            }
            selectItemsBetween(selectionStack.peek(clickStackId));
            scope.$apply();
            return;
          }

          // Use ctrl/shift without multi select to true toggle a row
          if(isCtrlKeyDown || isShiftKeyDown || isCheckboxClick) {
            var isSelected = !smItem[selectedAttribute];
            if(!isMultiMode) {
              deselectAllItemsExcept(smItem);
            }
            smItem[selectedAttribute] = isSelected;
            if(smItem[selectedAttribute]) {
              selectionStack.push(clickStackId, smItem);
            }
            scope.$apply();
            return;
          }

          // Otherwise the clicked on row becomes the only selected item
          deselectAllItemsExcept(smItem);
          scope.$apply();

          smItem[selectedAttribute] = true;
          selectionStack.push(clickStackId, smItem);
          scope.$apply();
        }
function(event) {

          /**
           * Set by the `selectionModelIgnore` directive
           *
           * Use `selectionModelIgnore` to cause `selectionModel` to selectively
           * ignore clicks on elements. This is useful if you want to manually
           * change a selection when certain things are clicked.
           */
          if(event.selectionModelIgnore || (event.originalEvent && event.originalEvent.selectionModelIgnore)) {
            return;
          }

          // Never handle a single click twice.
          if(event.selectionModelClickHandled || (event.originalEvent && event.originalEvent.selectionModelClickHandled)) {
            return;
          }
          event.selectionModelClickHandled = true;
          if(event.originalEvent) {
            event.originalEvent.selectionModelClickHandled = true;
          }

          var isCtrlKeyDown = event.ctrlKey || event.metaKey || isModeAdditive
            , isShiftKeyDown = event.shiftKey
            , target = event.target || event.srcElement
            , isCheckboxClick = 'checkbox' === smType &&
                'INPUT' === target.tagName &&
                'checkbox' === target.type;

          /**
           * Guard against label + checkbox clicks
           *
           * Clicking a label will cause a click event to also be fired on the
           * associated input element. If that input is nearby (i.e. under the
           * selection model element) we'll suppress the click on the label to
           * avoid duplicate click events.
           */
          if('LABEL' === target.tagName) {
            var labelFor = angular.element(target).attr('for');
            if(labelFor) {
              var childInputs = element[0].getElementsByTagName('INPUT'), ix;
              for(ix = childInputs.length; ix--;) {
                if(childInputs[ix].id === labelFor) {
                  return;
                }
              }
            } else if(target.getElementsByTagName('INPUT').length) {
              // Label has a nested input element, we'll handle the click on
              // that element
              return;
            }
          }

          // Select multiple allows for ranges - use shift key
          if(isShiftKeyDown && isMultiMode && !isCheckboxClick) {
            // Use ctrl+shift for additive ranges
            if(!isCtrlKeyDown) {
              scope.$apply(function() {
                deselectAllItemsExcept([smItem, selectionStack.peek(clickStackId)]);
              });
            }
            selectItemsBetween(selectionStack.peek(clickStackId));
            scope.$apply();
            return;
          }

          // Use ctrl/shift without multi select to true toggle a row
          if(isCtrlKeyDown || isShiftKeyDown || isCheckboxClick) {
            var isSelected = !smItem[selectedAttribute];
            if(!isMultiMode) {
              deselectAllItemsExcept(smItem);
            }
            smItem[selectedAttribute] = isSelected;
            if(smItem[selectedAttribute]) {
              selectionStack.push(clickStackId, smItem);
            }
            scope.$apply();
            return;
          }

          // Otherwise the clicked on row becomes the only selected item
          deselectAllItemsExcept(smItem);
          scope.$apply();

          smItem[selectedAttribute] = true;
          selectionStack.push(clickStackId, smItem);
          scope.$apply();
        }
function ( event ) { /**
           * Set by the `selectionModelIgnore` directive
           *
           * Use `selectionModelIgnore` to cause `selectionModel` to selectively
           * ignore clicks on elements. This is useful if you want to manually
           * change a selection when certain things are clicked.
           */ if ( event . selectionModelIgnore || ( event . originalEvent && event . originalEvent . selectionModelIgnore ) ) { return ; } // Never handle a single click twice.
 if ( event . selectionModelClickHandled || ( event . originalEvent && event . originalEvent . selectionModelClickHandled ) ) { return ; } event . selectionModelClickHandled = true ; if ( event . originalEvent ) { event . originalEvent . selectionModelClickHandled = true ; } var isCtrlKeyDown = event . ctrlKey || event . metaKey || isModeAdditive , isShiftKeyDown = event . shiftKey , target = event . target || event . srcElement , isCheckboxClick = 'checkbox' === smType && 'INPUT' === target . tagName && 'checkbox' === target . type ; /**
           * Guard against label + checkbox clicks
           *
           * Clicking a label will cause a click event to also be fired on the
           * associated input element. If that input is nearby (i.e. under the
           * selection model element) we'll suppress the click on the label to
           * avoid duplicate click events.
           */ if ( 'LABEL' === target . tagName ) { var labelFor = angular . element ( target ) . attr ( 'for' ) ; if ( labelFor ) { var childInputs = element [ 0 ] . getElementsByTagName ( 'INPUT' ) , ix ; for ( ix = childInputs . length ; ix -- ; ) { if ( childInputs [ ix ] . id === labelFor ) { return ; } } } else if ( target . getElementsByTagName ( 'INPUT' ) . length ) { // Label has a nested input element, we'll handle the click on
 // that element
 return ; } } // Select multiple allows for ranges - use shift key
 if ( isShiftKeyDown && isMultiMode && ! isCheckboxClick ) { // Use ctrl+shift for additive ranges
 if ( ! isCtrlKeyDown ) { scope . $apply ( function ( ) { deselectAllItemsExcept ( [ smItem , selectionStack . peek ( clickStackId ) ] ) ; } ) ; } selectItemsBetween ( selectionStack . peek ( clickStackId ) ) ; scope . $apply ( ) ; return ; } // Use ctrl/shift without multi select to true toggle a row
 if ( isCtrlKeyDown || isShiftKeyDown || isCheckboxClick ) { var isSelected = ! smItem [ selectedAttribute ] ; if ( ! isMultiMode ) { deselectAllItemsExcept ( smItem ) ; } smItem [ selectedAttribute ] = isSelected ; if ( smItem [ selectedAttribute ] ) { selectionStack . push ( clickStackId , smItem ) ; } scope . $apply ( ) ; return ; } // Otherwise the clicked on row becomes the only selected item
 deselectAllItemsExcept ( smItem ) ; scope . $apply ( ) ; smItem [ selectedAttribute ] = true ; selectionStack . push ( clickStackId , smItem ) ; scope . $apply ( ) ; }
Item click handler

Use the `ctrl` key to select/deselect while preserving the rest of
your selection. Note your your selection mode must be set to
`'multiple'` to allow for more than one selected item at a time. In
single select mode you still must use the `ctrl` or `shitft` keys to
deselect an item.

The `shift` key allows you to select ranges of items at a time. Use
`ctrl` + `shift` to select a range while preserving your existing
selection. In single select mode `shift` behaves like `ctrl`.

When an item is clicked with no modifier keys pressed it will be the
only selected item.

On Mac the `meta` key is treated as `ctrl`.

Note that when using the `'checkbox'` selection model type clicking
on a checkbox will have no effect on any row other than the one the
checkbox is in.
Item click handler