X Tutup
Skip to content

fix(router): handle URL that does not match a route#7379

Closed
petebacondarwin wants to merge 4 commits intoangular:masterfrom
petebacondarwin:fix-router-location-exception
Closed

fix(router): handle URL that does not match a route#7379
petebacondarwin wants to merge 4 commits intoangular:masterfrom
petebacondarwin:fix-router-location-exception

Conversation

@petebacondarwin
Copy link
Copy Markdown
Contributor

Only the last commit is relevant here. Once #7319 lands I'll rebase

Closes #7349
Closes #7203

@petebacondarwin petebacondarwin added type: bug/fix comp: router action: review The PR is still awaiting reviews from at least one requested reviewer labels Mar 2, 2016
@googlebot
Copy link
Copy Markdown

We found a Contributor License Agreement for you (the sender of this pull request) and all commit authors, but as best as we can tell these commits were authored by someone else. If that's the case, please add them to this pull request and have them confirm that they're okay with these commits being contributed to Google. If we're mistaken and you did author these commits, just reply here to confirm.

@petebacondarwin petebacondarwin force-pushed the fix-router-location-exception branch from 2d99f87 to 0ad1326 Compare March 3, 2016 13:19
@googlebot
Copy link
Copy Markdown

CLAs look good, thanks!

@googlebot googlebot added cla: yes and removed cla: no labels Mar 3, 2016
@petebacondarwin petebacondarwin force-pushed the fix-router-location-exception branch from 0ad1326 to d55652b Compare March 3, 2016 13:19
@petebacondarwin petebacondarwin force-pushed the fix-router-location-exception branch 3 times, most recently from 8f5a42f to 40fe70f Compare March 7, 2016 22:45
@btford btford added pr_state: LGTM action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Mar 8, 2016
@btford
Copy link
Copy Markdown
Contributor

btford commented Mar 8, 2016

LGTM, let's merge this!

@btford btford assigned vikerman and unassigned btford Mar 8, 2016
@vikerman
Copy link
Copy Markdown
Contributor

vikerman commented Mar 9, 2016

@petebacondarwin - Can you rebase this? Thanks

The directiveIntrospector was a bit of a hack to allow the router to
read the `$routeConfig` annocation and `$routerCanActivate` hook from
directives when they were registered.

It turns out that if we put these properties on the component controller's
constructor function (i.e. as static class methods) then we can simply
use the `$injector` to access it as required.

Currently, people put the properties directly on their component definition
objects. In Angular 1.5.1, we will copy these properties onto the controller
constructor to maintain a simple migration path. But going forward it may be
better to encourage people to add the properties directly to the controller
constructor.
These tests were registering new components after the application had
been bootstrapped, which is not a valid use case for synchronous routes
in Angular 1.

In particular it was registering the "root" component, which caused the
`$rootRouter` to blow up, when it was instantiated, pointing to a root
component that did not yet exist.
Until Angular 1.5.1 is released, the `$routeConfig` and `$routerCanActivate`
annotations for components must live on the controller constructor.

In Angular 1.5.1, it will automatically copy these annotations across from
the component definition file.
@petebacondarwin petebacondarwin force-pushed the fix-router-location-exception branch from 40fe70f to 520add7 Compare March 9, 2016 10:13
@petebacondarwin
Copy link
Copy Markdown
Contributor Author

@vikerman Rebased!

@evmar
Copy link
Copy Markdown
Contributor

evmar commented Mar 10, 2016

#7319 is in, can you rebase?

@alexeagle
Copy link
Copy Markdown
Contributor

merged as 8e3e450

@alexeagle alexeagle closed this Mar 10, 2016
@petebacondarwin petebacondarwin deleted the fix-router-location-exception branch September 2, 2017 14:43
@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 12, 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 cla: yes type: bug/fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(Router): Stack trace on unrecognized routes

6 participants

X Tutup