I want to create a project with dynamic route that only type name on url and then route will detect the url and create the own route access to that file to display to broswer
import { Routes,RouterModule } from '@angular/router';
const routes: Routes= GetDynamicRoute();
export const routing = RouterModule.forRoot(routes);
function GetDynamicRoute(){
var results :Array<Object> = Array<Object>();
var page = 'GET_URL_PARAMATER';
results.push({ path: '' ,loadChildren: 'app/tmp/home.module'});
results.push({ path: page, loadChildren: 'app/tmp/'+page+'.module' })
return results
}
There is a function called resetConfig
inside of the Router
.
See this Github issue with some plunkers inside: https://github.com/angular/angular/issues/11437#issuecomment-245995186
And the official docs: https://angular.io/docs/ts/latest/api/router/index/Router-class.html#!#resetConfig-anchor
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With