File tree Expand file tree Collapse file tree 2 files changed +17
-6
lines changed
Expand file tree Collapse file tree 2 files changed +17
-6
lines changed Original file line number Diff line number Diff line change @@ -120,9 +120,14 @@ export class <PipeName>Pipe implements PipeTransform {
120120` ng2-routes ` creates the ` @Routes ` decorator with a single route in it.
121121
122122``` ts
123- @Routes ([
124- { path: ' /<route>' , component: <component -name > }
125- ])
123+ import { RouterModule , Routes } from ' @angular/router' ;
124+
125+ const app_routes: Routes = [
126+ { path: ' <url-segment>' , component: <component -name > },
127+ { path: ' **' , pathMatch: ' full' , redirectTo: ' <url-segment>' }
128+ ];
129+
130+ export const app_routing = RouterModule .forRoot (app_routes );
126131```
127132
128133### ng2-route-path
Original file line number Diff line number Diff line change 6868 ' description' : ' Angular 2 route config snippet'
6969 ' descriptionMoreURL' : ' https://angular.io/docs/ts/latest/api/router/Route-class.html'
7070 ' body' : """
71- @Routes([
72- { path: '/${1:path}', component: ${2:component} }$3
73- ])
71+ import { RouterModule, Routes } from '@angular/router';
72+
73+ const app_routes: Routes = [
74+ { path: '${1:routePath}', component: ${2:Component} },
75+ { path: '**', pathMatch: 'full', redirectTo: '$1' }
76+ ];
77+
78+ export const app_routing = RouterModule.forRoot(app_routes);
79+ $3
7480 """
7581 ' Angular Route Definition' :
7682 ' prefix' : ' ng2-route-path'
You can’t perform that action at this time.
0 commit comments