Commits

rbt authored 17a9dedae9d
Fixed an error that popped up after enablign strict mode
No tags

src/app/api/api.service.ts

Modified
1 -import {Injectable} from '@angular/core';
1 +import {Inject, Injectable} from '@angular/core';
2 2 import {HttpClient} from '@angular/common/http';
3 3 import {Observable} from 'rxjs';
4 4 import {apiBase} from '../../utils/URL_STRING_LITERALS';
5 5 import {of} from 'rxjs/internal/observable/of';
6 6
7 -@Injectable({
8 - providedIn: 'root'
9 -})
7 +@Injectable({providedIn: 'root'})
10 8 export class ApiService {
11 9
12 - constructor(protected url: string,
13 - protected httpClient: HttpClient) {
10 + constructor(@Inject(String) protected url: string, protected httpClient: HttpClient) {
14 11 this.url = apiBase + url;
15 12 }
16 13
17 14 public create(resource: any): Observable<any> {
18 15 return this.httpClient.post(this.url, resource);
19 16 }
20 17
21 18 public getAll(): Observable<any> {
22 19 return this.httpClient.get(this.url);
23 20 }

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut