src/components/sidenav/sidenav.js
function toggleOpen(isOpen) {
      if (scope.isOpen === isOpen) {
        return $q.when(true);
      } else {
        if (scope.isOpen && sidenavCtrl.onCloseCb) sidenavCtrl.onCloseCb();

        return $q(function(resolve) {
          // Toggle value to force an async `updateIsOpen()` to run
          scope.isOpen = isOpen;

          $mdUtil.nextTick(function() {
            // When the current `updateIsOpen()` animation finishes
            promise.then(function(result) {

              if (!scope.isOpen && triggeringElement && triggeringInteractionType === 'keyboard') {
                // reset focus to originating element (if available) upon close
                triggeringElement.focus();
                triggeringElement = null;
              }

              resolve(result);
            });
          });
        });
      }
    }
function toggleOpen(isOpen) {
      if (scope.isOpen === isOpen) {
        return $q.when(true);
      } else {
        if (scope.isOpen && sidenavCtrl.onCloseCb) sidenavCtrl.onCloseCb();

        return $q(function(resolve) {
          // Toggle value to force an async `updateIsOpen()` to run
          scope.isOpen = isOpen;

          $mdUtil.nextTick(function() {
            // When the current `updateIsOpen()` animation finishes
            promise.then(function(result) {

              if (!scope.isOpen && triggeringElement && triggeringInteractionType === 'keyboard') {
                // reset focus to originating element (if available) upon close
                triggeringElement.focus();
                triggeringElement = null;
              }

              resolve(result);
            });
          });
        });
      }
    }
function toggleOpen ( isOpen ) { if ( scope . isOpen === isOpen ) { return $q . when ( true ) ; } else { if ( scope . isOpen && sidenavCtrl . onCloseCb ) sidenavCtrl . onCloseCb ( ) ; return $q ( function ( resolve ) { // Toggle value to force an async `updateIsOpen()` to run scope . isOpen = isOpen ; $mdUtil . nextTick ( function ( ) { // When the current `updateIsOpen()` animation finishes promise . then ( function ( result ) { if ( ! scope . isOpen && triggeringElement && triggeringInteractionType === 'keyboard' ) { // reset focus to originating element (if available) upon close triggeringElement . focus ( ) ; triggeringElement = null ; } resolve ( result ) ; } ) ; } ) ; } ) ; } }
Toggle the sideNav view and publish a promise to be resolved when
the view animation finishes.
@param {boolean} isOpen true to open the sidenav, false to close it
@returns {*} promise to be resolved when the view animation finishes
Toggle the sideNav view and publish a promise to be resolved when the view animation finishes .