Commits
rbt authored 17a9dedae9d
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 | } |