Last active
August 19, 2018 14:46
-
-
Save RayLuxembourg/69586474c3c006eb3a5e78bed2a69e94 to your computer and use it in GitHub Desktop.
Api Service
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//src/common/services/api.service.ts | |
@Injectable({ providedIn: 'root' }) | |
export class ApiService { | |
monitor = "/monitor"; | |
analytics = "/analytics"; | |
api = "/api" | |
constructor(private httpClient: HttpClient) { } | |
apiCallExample() { | |
return this.httpClient.get(`${this.api}/products`); | |
} | |
monitorCallExample(someInfo = {}) { | |
return this.httpClient.put(`${this.monitor}/23874`, someInfo); | |
} | |
analyticsCallExample(event = {}) { | |
return this.httpClient.post(`${this.analytics}/expend`, event) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment