Angular 4 router: direct browser navigation restarts app -


when use browser directly navigate route app re-bootstraps , takes me correct page/component. when navigate through button example takes me there directly without re-bootstrapping app.

is expected behavior? how can prevent this?

the problem use identity server our authentication. requires callback url, treated direct browser navigation , app re-bootstraps.

our app-routing.module looks this:

const routes: routes = [   { path: '', redirectto: '/dashboard', pathmatch: 'full' },   { path: 'dashboard', component: dashboardcomponent, canactivate: [routeguardservice] },   { path: 'users', component: usersmaincomponent},   { path: 'vendors', component: vendormaincomponent},   { path: 'invoices', component: invoicesmaincomponent},   { path: 'offers' , component: esdmaincomponent},   { path: 'settings' , component: settingsmaincomponent},   { path: 'callback' , component: callbackcomponent},   { path: 'createvendor' , component: createvendorscomponent, canactivate: [routeguardservice]},   { path: 'customerdashboard' , component: customerdashboardcomponent}, ];  @ngmodule({   imports: [routermodule.forroot(routes)],   exports: [routermodule],   providers: [routeguardservice] }) export class approutingmodule { } 

the callback path callback url identity server.

yes expected behaviour. when route button within angular application using pushstate modify history as described in docs (down @ bottom).

when direct navigation fetch index.html, bootstrap app , app use current url determine component(s) show.

the answer question covers how resolve issue.


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -