Skip to content

Commit 5670f41

Browse files
John PapaJohn Papa
authored andcommitted
added a-routes for router.ts file.
1 parent ecf7345 commit 5670f41

File tree

3 files changed

+20
-15
lines changed

3 files changed

+20
-15
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
## Angular Snippets Changelog
22

3+
<a name="9.1.0"></a>
4+
5+
# 9.1.0 (2020-02-22)
6+
7+
- Added `a-trackby` to create a trackby function in TypeScript for the `ngFor`
8+
- Removed `a-module-routing` and replaced with `a-routes`. Routes will be defined in a `router.ts` file and no more Routing Module.
9+
310
<a name="9.0.1"></a>
411

512
# 9.0.1 (2020-02-10)

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ Alternatively, press `Ctrl`+`Space` (Windows, Linux) or `Cmd`+`Space` (macOS) to
3131
| `a-component` | component |
3232
| `a-component-inline` | component with inline template |
3333
| `a-component-root` | root app component |
34+
| `a-ctor-skip-self` | angular `NgModule`'s `skipself` constructor |
3435
| `a-directive` | directive |
3536
| `a-guard-can-activate` | `CanActivate` guard |
3637
| `a-guard-can-activate-child` | `CanActivateChild` guard |
@@ -42,12 +43,12 @@ Alternatively, press `Ctrl`+`Space` (Windows, Linux) or `Cmd`+`Space` (macOS) to
4243
| `a-http-interceptor-logging` | Angular `HttpInterceptor` that logs traffic for `HttpClient` |
4344
| `a-module` | module |
4445
| `a-module-root` | root app module |
45-
| `a-module-routing` | routing module file (forChild) |
4646
| `a-output-event` | `@Output` event and emitter |
4747
| `a-pipe` | pipe |
4848
| `a-preload-opt-in-strategy` | custom preload strategy that allows choosing which routes to preload |
4949
| `a-preload-network-strategy` | custom preload strategy that preloads based on network connectivity |
5050
| `a-resolver` | resolver |
51+
| `a-routes` | Route definition file |
5152
| `a-rxjs-import` | import RxJs features |
5253
| `a-rxjs-operators` | import RxJs operators |
5354
| `a-route-path-404` | 404 route path |
@@ -59,8 +60,8 @@ Alternatively, press `Ctrl`+`Space` (Windows, Linux) or `Cmd`+`Space` (macOS) to
5960
| `a-route-params-subscribe` | subscribe to route parameters |
6061
| `a-service` | service with injectable provided in root |
6162
| `a-service-httpclient` | service with `HttpClient` |
62-
| `a-ctor-skip-self` | angular `NgModule`'s `skipself` constructor |
6363
| `a-subscribe` | Rx Observable subscription |
64+
| `a-trackby` | to create a trackby function in TypeScript for the `ngFor` |
6465

6566
### NgRx Snippets
6667

snippets/typescript.json

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -243,21 +243,13 @@
243243
"$0"
244244
]
245245
},
246-
"Angular Module with Routing": {
247-
"prefix": "a-module-with-routing",
248-
"description": "Angular module with routing combined into one file",
246+
"Route definitions": {
247+
"prefix": "a-routes",
248+
"description": "Route definitions",
249249
"body": [
250-
"import { NgModule } from '@angular/core';",
251-
"import { Routes, RouterModule } from '@angular/router';",
252-
"",
253-
"const routes: Routes = [${0}]",
250+
"import { Routes } from '@angular/router';",
254251
"",
255-
"@NgModule({",
256-
"\timports: [RouterModule.${2:forChild}(routes)],",
257-
"\texports: [],",
258-
"\tdeclarations: [],",
259-
"})",
260-
"export class ${1:Name}Module { }"
252+
"export const routes: Routes = [${0}]"
261253
]
262254
},
263255
"Angular Module": {
@@ -608,5 +600,10 @@
608600
" }",
609601
"}"
610602
]
603+
},
604+
"TrackBy Function": {
605+
"prefix": "a-trackby",
606+
"description": "TrackBy Function",
607+
"body": ["${1:trackBy}(index: number, ${2:name}: ${3:model}): ${4:number} {", " return ${2:name}${5:.id};$0", "}"]
611608
}
612609
}

0 commit comments

Comments
 (0)