Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 15 additions & 5 deletions snippets/html.json
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,9 @@
"import { CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';",
"import { Observable } from 'rxjs';",
"",
"@Injectable()",
"@Injectable({",
"\tprovidedIn: 'root'",
"})",
"export class ${CanActivate}Guard implements CanActivate {",
"\tcanActivate(",
"\t\troute: ActivatedRouteSnapshot,",
Expand All @@ -175,7 +177,9 @@
"import { CanActivateChild, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';",
"import { Observable } from 'rxjs';",
"",
"@Injectable()",
"@Injectable({",
"\tprovidedIn: 'root'",
"})",
"export class ${CanActivateChild}Guard implements CanActivateChild {",
"\tcanActivateChild(",
"\t\troute: ActivatedRouteSnapshot,",
Expand All @@ -196,7 +200,9 @@
"import { Resolve, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';",
"import { Observable } from 'rxjs';",
"",
"@Injectable()",
"@Injectable({",
"\tprovidedIn: 'root'",
"})",
"export class ${Resolve}Guard implements Resolve<${T}> {",
"\tresolve(",
"\t\troute: ActivatedRouteSnapshot,",
Expand All @@ -217,7 +223,9 @@
"import { CanLoad, Route } from '@angular/router';",
"import { Observable } from 'rxjs';",
"",
"@Injectable()",
"@Injectable({",
"\tprovidedIn: 'root'",
"})",
"export class ${CanLoad}Guard implements CanLoad {",
"\tcanLoad(",
"\t\t${route}: Route",
Expand All @@ -237,7 +245,9 @@
"import { CanDeactivate, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';",
"import { Observable } from 'rxjs';",
"",
"@Injectable()",
"@Injectable({",
"\tprovidedIn: 'root'",
"})",
"export class ${CanDeactivate}Guard implements CanDeactivate<${T}> {",
"\tcanDeactivate(",
"\t\tcomponent: ${T},",
Expand Down
32 changes: 24 additions & 8 deletions snippets/typescript.json
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,9 @@
"body": [
"import { Injectable } from '@angular/core';",
"",
"@Injectable()",
"@Injectable({",
"\tprovidedIn: 'root'",
"})",
"export class ${Name}Service {",
"$0}"
]
Expand Down Expand Up @@ -982,7 +984,9 @@
"import { CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';",
"import { Observable } from 'rxjs';",
"",
"@Injectable()",
"@Injectable({",
"\tprovidedIn: 'root'",
"})",
"export class ${CanActivate}Guard implements CanActivate {",
"\tcanActivate(",
"\t\troute: ActivatedRouteSnapshot,",
Expand All @@ -1003,7 +1007,9 @@
"import { CanActivateChild, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';",
"import { Observable } from 'rxjs';",
"",
"@Injectable()",
"@Injectable({",
"\tprovidedIn: 'root'",
"})",
"export class ${CanActivateChild}Guard implements CanActivateChild {",
"\tcanActivateChild(",
"\t\troute: ActivatedRouteSnapshot,",
Expand All @@ -1024,7 +1030,9 @@
"import { Resolve, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';",
"import { Observable } from 'rxjs';",
"",
"@Injectable()",
"@Injectable({",
"\tprovidedIn: 'root'",
"})",
"export class ${Resolve}Guard implements Resolve<${T}> {",
"\tresolve(",
"\t\troute: ActivatedRouteSnapshot,",
Expand All @@ -1045,7 +1053,9 @@
"import { CanLoad, Route } from '@angular/router';",
"import { Observable } from 'rxjs';",
"",
"@Injectable()",
"@Injectable({",
"\tprovidedIn: 'root'",
"})",
"export class ${CanLoad}Guard implements CanLoad {",
"\tcanLoad(",
"\t\t${route}: Route",
Expand All @@ -1065,7 +1075,9 @@
"import { CanDeactivate, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';",
"import { Observable } from 'rxjs';",
"",
"@Injectable()",
"@Injectable({",
"\tprovidedIn: 'root'",
"})",
"export class ${CanDeactivate}Guard implements CanDeactivate<${T}> {",
"\tcanDeactivate(",
"\t\tcomponent: ${T},",
Expand Down Expand Up @@ -1320,7 +1332,9 @@
"import { Action } from '@ngrx/store';",
"import { Actions, Effect, ofType } from '@ngrx/effects';",
"",
"@Injectable()",
"@Injectable({",
"\tprovidedIn: 'root'",
"})",
"export class ${Name}Effects {",
"\t@Effect() ${name}$: Observable<Action> = this.actions$.pipe(ofType('${ACTIONTYPE}'))$1;",
"",
Expand Down Expand Up @@ -3097,7 +3111,9 @@
"\tHttpEvent, HttpInterceptor, HttpHandler, HttpRequest",
"} from '@angular/common/http';",
"",
"@Injectable()",
"@Injectable({",
"\tprovidedIn: 'root'",
"})",
"export class ${1:Name}Interceptor implements HttpInterceptor {",
"\tintercept(req: HttpRequest<any>, next: HttpHandler) {",
"\t\treturn next.handle(req);",
Expand Down
32 changes: 24 additions & 8 deletions src/snippets.json
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,9 @@
"body": [
"import { Injectable } from '@angular/core';",
"",
"@Injectable()",
"@Injectable({",
"\tprovidedIn: 'root'",
"})",
"export class ${Name}Service {",
"$0}"
]
Expand Down Expand Up @@ -982,7 +984,9 @@
"import { CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';",
"import { Observable } from 'rxjs';",
"",
"@Injectable()",
"@Injectable({",
"\tprovidedIn: 'root'",
"})",
"export class ${CanActivate}Guard implements CanActivate {",
"\tcanActivate(",
"\t\troute: ActivatedRouteSnapshot,",
Expand All @@ -1003,7 +1007,9 @@
"import { CanActivateChild, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';",
"import { Observable } from 'rxjs';",
"",
"@Injectable()",
"@Injectable({",
"\tprovidedIn: 'root'",
"})",
"export class ${CanActivateChild}Guard implements CanActivateChild {",
"\tcanActivateChild(",
"\t\troute: ActivatedRouteSnapshot,",
Expand All @@ -1024,7 +1030,9 @@
"import { Resolve, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';",
"import { Observable } from 'rxjs';",
"",
"@Injectable()",
"@Injectable({",
"\tprovidedIn: 'root'",
"})",
"export class ${Resolve}Guard implements Resolve<${T}> {",
"\tresolve(",
"\t\troute: ActivatedRouteSnapshot,",
Expand All @@ -1045,7 +1053,9 @@
"import { CanLoad, Route } from '@angular/router';",
"import { Observable } from 'rxjs';",
"",
"@Injectable()",
"@Injectable({",
"\tprovidedIn: 'root'",
"})",
"export class ${CanLoad}Guard implements CanLoad {",
"\tcanLoad(",
"\t\t${route}: Route",
Expand All @@ -1065,7 +1075,9 @@
"import { CanDeactivate, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';",
"import { Observable } from 'rxjs';",
"",
"@Injectable()",
"@Injectable({",
"\tprovidedIn: 'root'",
"})",
"export class ${CanDeactivate}Guard implements CanDeactivate<${T}> {",
"\tcanDeactivate(",
"\t\tcomponent: ${T},",
Expand Down Expand Up @@ -1320,7 +1332,9 @@
"import { Action } from '@ngrx/store';",
"import { Actions, Effect, ofType } from '@ngrx/effects';",
"",
"@Injectable()",
"@Injectable({",
"\tprovidedIn: 'root'",
"})",
"export class ${Name}Effects {",
"\t@Effect() ${name}$: Observable<Action> = this.actions$.pipe(ofType('${ACTIONTYPE}'))$1;",
"",
Expand Down Expand Up @@ -3097,7 +3111,9 @@
"\tHttpEvent, HttpInterceptor, HttpHandler, HttpRequest",
"} from '@angular/common/http';",
"",
"@Injectable()",
"@Injectable({",
"\tprovidedIn: 'root'",
"})",
"export class ${1:Name}Interceptor implements HttpInterceptor {",
"\tintercept(req: HttpRequest<any>, next: HttpHandler) {",
"\t\treturn next.handle(req);",
Expand Down