Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const appRoutes: Routes = [
- { path: '', redirectTo: '/login', pathMatch: 'full' },
- { path: 'page1', component: Page1Component }, // can't use RouterStringService here I don't think...
- { path: 'page2', component: Page2Component }
- ]
- @NgModule({...})
- export class AppRouting Module {}
- // changes to above code block
- { path: 'page1', redirectTo: 'new-page1' },
- { path: 'new-page1', component NewPage1Component },
- export class RouterStringService {
- static page1: string = '/page1'
- static page2: string = '/page2
- // put string builders here too for things like /pageX/:id
- constructor() {}
- }
- export const AppUrls = {
- base: "...",
- login: "...",
- ...
- }
- const appRoutes: Routes = [
- { path: '', redirectTo: AppUrls.login, pathMatch: 'full' },
- import {AppUrls} from '....';
- @Component({
- selector: '...
- })
- export class SomeComponent implements OnInit {
- AppUrls = AppUrls;
- [routerLink]="{{AppUrls.login}}"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement