question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Ng2 router should store destination route

See original GitHub issue

To avoid forgetting it as this is the last issue to solve before being able to remove ui-router completely from package.json

register-transition-hooks.ts used to configure ui-router , it had 3 responsibilities on state transitions:

  1. store destination state in case to bring user to it later in case she has to login first
  2. support for external URLs in ui-router
  3. set page title

Only first one is not yet covered and relates to StateStorageService that should probably be renamed to RouteStorageService.

    $transitions.onStart({}, (transition: Transition) => {
        let $storageService = transition.injector().get(StateStorageService);
        $storageService.storeDestinationState(transition.to(), transition.params(), transition.from());
        let principal = transition.injector().get(Principal);
        let auth = transition.injector().get(AuthService);
        if (principal.isIdentityResolved()) {
            auth.authorize();
        }

        <%_ if (enableTranslation) { _%>
        // Update the language //FIXME not sure if this is required, its causing some weird error as well
        /*let languageService = transition.injector().get(JhiLanguageService);
        languageService.getCurrent().then(current => {
            languageService.changeLanguage(current);
        });*/
        <%_ } _%>
    });

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
VictorADScommented, Jan 23, 2017

I’m on it

0reactions
deepu105commented, Jan 24, 2017

I hope so

Thanks & Regards, Deepu

On Tue, Jan 24, 2017 at 10:19 AM, VictorADS notifications@github.com wrote:

@deepu105 https://github.com/deepu105 I wouldn’t call this workarounds, it’s just another way to treat routes. Also, even though it was easier in ui-router, I remember it had some problems with regards to the transition hooker. I think migrating to ng-router is for the better

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/jhipster/generator-jhipster/issues/4930#issuecomment-274750058, or mute the thread https://github.com/notifications/unsubscribe-auth/ABDlFzPFqQp_0lD4USxg0q6Oe4fVk9gSks5rVcI1gaJpZM4LqjHI .

Read more comments on GitHub >

github_iconTop Results From Across the Web

Common Routing Tasks - Angular
The order of routes is important because the Router uses a first-match wins strategy when matching routes, so more specific routes should be...
Read more >
222 - Stack Overflow
To navigate a relative path with the Router.navigate method, you must supply the ActivatedRoute to give the router knowledge of where you are...
Read more >
Location Strategy- Routing in Angular2 - Knoldus Blogs
Routing enables you to route the user to different components based on the url that they type on the browser, or that you...
Read more >
Angular 2 Series - Part 4: Component Router In-Depth - Auth0
The router-outlet in the main App component can only show the Home route right now, but of course want to show others routes...
Read more >
How to use Routing in Angular - malcoded
The Angular Router Module ... All routing related things are inside of the RouterModule. This module comes with angular. So to use routing,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found