Projekt

Obecné

Profil

Stáhnout (1.17 KB) Statistiky
| Větev: | Tag: | Revize:
1 dc394493 Václav Jirák
import { Component, OnInit } from '@angular/core';
2
import { HttpClient } from '@angular/common/http';
3
import { environment } from '../environments/environment';
4
5
@Component({
6
  selector: 'app-root',
7
  templateUrl: './app.component.html',
8
  styleUrls: ['./app.component.sass']
9
})
10
export class AppComponent implements OnInit {
11
  getTestResponse;
12
  postTestResponse;
13
  enHelloWorldResponse;
14
  czHelloWorldResponse;
15
  databaseResponse;
16
  constructor(private httpClient: HttpClient) {}
17
18
  ngOnInit() {
19
    this.httpClient.get(environment.apiUrl + 'test', { responseType: 'text' })
20
      .subscribe(data => this.getTestResponse = data);
21
22
    this.httpClient.get(environment.apiUrl + 'test', { responseType: 'text' })
23
      .subscribe(data => this.postTestResponse = data);
24
25
    this.httpClient.get(environment.apiUrl + 'hello', { responseType: 'text' })
26
      .subscribe(data => this.enHelloWorldResponse = data);
27
28
    this.httpClient.get(environment.apiUrl + 'hello?lang=cz', { responseType: 'text' })
29
      .subscribe(data => this.czHelloWorldResponse = data);
30
31
    this.httpClient.get(environment.apiUrl + 'database', { responseType: 'text' })
32
      .subscribe(data => this.databaseResponse = data);
33
  }
34
}