Advertisement
Guest User

Untitled

a guest
Mar 20th, 2019
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. const appRoutes: Routes = [
  2. { path: '', redirectTo: '/login', pathMatch: 'full' },
  3. { path: 'page1', component: Page1Component }, // can't use RouterStringService here I don't think...
  4. { path: 'page2', component: Page2Component }
  5. ]
  6. @NgModule({...})
  7. export class AppRouting Module {}
  8.  
  9. // changes to above code block
  10. { path: 'page1', redirectTo: 'new-page1' },
  11. { path: 'new-page1', component NewPage1Component },
  12.  
  13. export class RouterStringService {
  14. static page1: string = '/page1'
  15. static page2: string = '/page2
  16.  
  17. // put string builders here too for things like /pageX/:id
  18.  
  19. constructor() {}
  20. }
  21.  
  22. export const AppUrls = {
  23. base: "...",
  24. login: "...",
  25. ...
  26. }
  27.  
  28. const appRoutes: Routes = [
  29. { path: '', redirectTo: AppUrls.login, pathMatch: 'full' },
  30.  
  31. import {AppUrls} from '....';
  32.  
  33. @Component({
  34. selector: '...
  35. })
  36. export class SomeComponent implements OnInit {
  37.  
  38. AppUrls = AppUrls;
  39.  
  40. [routerLink]="{{AppUrls.login}}"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement