code: function toggleOpen(isOpen) {
          if (scope.isOpen === isOpen) {
            return $q.when(true);
          }
          var deferred = $q.defer();
          // Toggle value to force an async `updateIsOpen()` to run
          scope.isOpen = isOpen;
          $timeout(setElementFocus, 0, false);
  
          return deferred.promise;
  
          function setElementFocus() {
            // When the current `updateIsOpen()` animation finishes
            promise.then(function (result) {
              if (!scope.isOpen) {
                // reset focus to originating element (if available) upon close
                triggeringElement && triggeringElement.focus();
                triggeringElement = null;
              }
  
              deferred.resolve(result);
            });
          }
        }
docs: Toggle the toggleComponent view and publish a promise to be resolved when
  the view animation finishes.
  
  @param isOpen
  @returns {*}