Skip to content

feat(router): add CanDeactivate next state argument - #13560

Merged
hansl merged 1 commit into
angular:masterfrom
DzmitryShylovich:gh/9853
Dec 27, 2016
Merged

hansl merged 1 commit into
angular:masterfrom
DzmitryShylovich:gh/9853

Conversation

@DzmitryShylovich

Copy link
Copy Markdown
Contributor

Closes #9853

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

currentRoute

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need a proper test

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consistency b vs nextState

@vicb vicb added area: router action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews pr_state: LGTM labels Dec 20, 2016
@vicb

vicb commented Dec 20, 2016

Copy link
Copy Markdown
Contributor

I'm not very clear on the use case but this is what should be tested in the integration test.

@DzmitryShylovich

Copy link
Copy Markdown
Contributor Author

@vicb

should be tested in the integration test.

done

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe use a log and assert the content in test test ?

@vicb

vicb commented Dec 20, 2016

Copy link
Copy Markdown
Contributor

Could you please:

  • address the comment in the tests,
  • add a description of what this feature is in the commit comment.

Thanks !

@DzmitryShylovich

Copy link
Copy Markdown
Contributor Author

@vicb done

@vicb

vicb commented Dec 21, 2016 •

Copy link
Copy Markdown
Contributor

Could you please reword it as

Adds a `nextState` argument to access the future url from `CanDeactivate`.

BEFORE:
    
    canDeactivate(component: T, route: ActivatedRouteSnapshot, state: RouterStateSnapshot)
        : Observable<boolean>|Promise<boolean>|boolean;

AFTER:

    canDeactivate(component: T, currentRoute: ActivatedRouteSnapshot, currentState: RouterStateSnapshot,
                  nextState?: RouterStateSnapshot): Observable<boolean>|Promise<boolean>|boolean;

@DzmitryShylovich

Copy link
Copy Markdown
Contributor Author

@vicb could u reword it on merge? :)

@vicb

vicb commented Dec 21, 2016

Copy link
Copy Markdown
Contributor

I would but I'm not merging this week

@nheidloff

Copy link
Copy Markdown

This seems promising. I hope it will be merged soon. Thanks @DzmitryShylovich

Adds a `nextState` argument to access the future url from `CanDeactivate`.

BEFORE:

    canDeactivate(component: T, route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean>|Promise<boolean>|boolean;

AFTER:

    canDeactivate(component: T, currentRoute: ActivatedRouteSnapshot, currentState: RouterStateSnapshot, nextState?: RouterStateSnapshot): Observable<boolean>|Promise<boolean>|boolean;

Closes angular#9853
@DzmitryShylovich

DzmitryShylovich commented Dec 21, 2016 •

Copy link
Copy Markdown
Contributor Author

@vicb

I would but I'm not merging this week

oke, I did it

@vicb vicb added action: merge The PR is ready for merge by the caretaker and removed action: cleanup The PR is in need of cleanup, either due to needing a rebase or in response to comments from reviews labels Dec 27, 2016
@hansl
hansl merged commit 69fa3bb into angular:master Dec 27, 2016
@angular-automatic-lock-bot

Copy link
Copy Markdown

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot Bot locked and limited conversation to collaborators Sep 10, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker area: router cla: yes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Router 3] CanDeactivate target route

5 participants