Future<bool> routerCanDeactivate(ComponentInstruction nextInstruction)

Called by the Router during recognition phase of a navigation.

If this resolves to false, the given navigation is cancelled.

This method delegates to the child component's routerCanDeactivate hook if it exists, and otherwise resolves to true.

Source

Future<bool> routerCanDeactivate(ComponentInstruction nextInstruction) {
  if (_currentInstruction == null) {
    return new Future.value(true);
  }
  return this._componentRef.then((ComponentRef ref) =>
      hasLifecycleHook(hook_mod.routerCanDeactivate, ref.instance)
          ? ((ref.instance as CanDeactivate))
              .routerCanDeactivate(nextInstruction, this._currentInstruction)
          : true);
}