Ignore:
Timestamp:
08/07/20 10:59:56 (3 years ago)
Author:
Mile Jankuloski <mile.jankuloski@…>
Branches:
master
Children:
63d885e
Parents:
c73269d
Message:

Added DataService and dialogs, all bindings needed implemented

File:
1 edited

Legend:

Unmodified
Added
Removed
  • Farmatiko/ClientApp/src/app/korona/korona.component.ts

    rc73269d ree137aa  
    1 import { Component, OnInit, Inject } from '@angular/core';
    2 import { Pandemic } from '../models/Pandemic';
    3 import { MatTableDataSource } from '@angular/material/table';
    4 import { HttpClient } from '@angular/common/http';
     1import { Component, OnInit } from '@angular/core';
     2import { DataService } from '../shared/data.service';
     3import { IPandemic } from '../shared/interfaces';
    54
    65@Component({
     
    109})
    1110export class KoronaComponent implements OnInit {
    12   public korona: Pandemic[];
     11  public korona: IPandemic;
    1312
    14   constructor(http: HttpClient, @Inject('BASE_URL') baseUrl: string) {
    15     http.get<Pandemic[]>(baseUrl + 'Pandemic/Get?').subscribe(result => {
    16       this.korona = result;
    17       console.log(this.korona);
    18     }, error => console.error(error));
     13  constructor(private dataService: DataService) {
     14
    1915  }
    2016
    2117  ngOnInit(): void {
     18    this.dataService.getPandemic()
     19        .subscribe((res: IPandemic) => {
     20          this.korona = res;
     21        },
     22        (err: any) => console.log(err),
     23        () => console.log('Pandemic data retrieved'));
    2224  }
    2325
Note: See TracChangeset for help on using the changeset viewer.