Skip to content

Commit

Permalink
feat(uiCanExit): Add controller lifecycle hook "uiCanExit"
Browse files Browse the repository at this point in the history
  • Loading branch information
christopherthielen committed Mar 26, 2016
1 parent 1552032 commit afcfe95
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/ng1/viewDirective.ts
Original file line number Diff line number Diff line change
Expand Up @@ -420,9 +420,9 @@ function registerControllerCallbacks($transitions: TransitionService, controller
$scope.$on('$destroy', $transitions.onError({}, ['$error$', '$transition$', onDynamic]));
}

// Add component-level hook for canDeactivate
if (isFunction(controllerInstance.canDeactivate)) {
$scope.$on('$destroy', $transitions.onBefore({exiting: cfg.node.state.name}, controllerInstance.canDeactivate.bind(controllerInstance)));
// Add component-level hook for uiCanExit
if (isFunction(controllerInstance.uiCanExit)) {
$scope.$on('$destroy', $transitions.onBefore({exiting: cfg.node.state.name}, controllerInstance.uiCanExit.bind(controllerInstance)));
}
}

Expand Down

0 comments on commit afcfe95

Please sign in to comment.