Skip to content

Commit 9420ee6

Browse files
John PapaJohn Papa
authored andcommitted
interceptor fixes
1 parent 3cc6fcc commit 9420ee6

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
## Angular Snippets Changelog
22

3-
<a name="8.3.0"></a>
3+
<a name="8.3.1"></a>
4+
5+
# 8.3.1 (2020-02-01)
6+
7+
- Revised `a-http-interceptor` to prompt for interceptor name
8+
- Revised interceptors to use `@Injectable()`
49

510
# 8.3.0 (2019-12-18)
611

snippets/typescript.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@
139139
"import { HttpInterceptor, HttpHandler, HttpRequest, HttpEvent, HttpResponse } from '@angular/common/http';",
140140
"import { Observable, tap } from 'rxjs';",
141141
"",
142-
"@Injectable({providedIn: ${1:'root'}})",
142+
"@Injectable()",
143143
"export class LogInterceptor implements HttpInterceptor {",
144144
"\tconstructor() {}",
145145
"",
@@ -165,7 +165,7 @@
165165
"import { HttpEvent, HttpInterceptor, HttpHandler, HttpRequest } from '@angular/common/http';",
166166
"import { Observable } from 'rxjs';",
167167
"",
168-
"@Injectable({providedIn: ${1:'root'}})",
168+
"@Injectable()",
169169
"export class HeaderInterceptor implements HttpInterceptor {",
170170
"\tconstructor() {}",
171171
"",
@@ -186,8 +186,8 @@
186186
"import { HttpInterceptor, HttpEvent, HttpHandler, HttpRequest } from '@angular/common/http';",
187187
"import { Observable } from 'rxjs';",
188188
"",
189-
"@Injectable({providedIn: ${1:'root'}})",
190-
"export class HeaderInterceptor implements HttpInterceptor {",
189+
"@Injectable()",
190+
"export class ${2:Your}Interceptor implements HttpInterceptor {",
191191
"\tintercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {",
192192
"\t\treturn next.handle(req);",
193193
"\t}",

0 commit comments

Comments
 (0)