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

Added DataService and dialogs, all bindings needed implemented

Location:
Farmatiko/ClientApp/src/app/korona
Files:
2 edited

Legend:

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

    rc73269d ree137aa  
    1212    <div class="col">
    1313      <div class="counter">
    14         <i class="fa fa-code fa-2x" *ngIf="korona">{{korona[0].totalMK}}</i>
     14        <i class="fa fa-code fa-2x" *ngIf="korona">{{korona.totalMK}}</i>
    1515        <h2 class="timer count-title count-number"></h2>
    1616        <p class="count-text ">Вкупно случаи во земјата</p>
     
    1919    <div class="col">
    2020      <div class="counter">
    21         <i class="fa fa-coffee fa-2x" *ngIf="korona">{{korona[0].activeMK}}</i>
     21        <i class="fa fa-coffee fa-2x" *ngIf="korona">{{korona.activeMK}}</i>
    2222        <h2 class="timer count-title count-number"></h2>
    2323        <p class="count-text ">Активни случаи во земјата</p>
     
    2626    <div class="col">
    2727      <div class="counter">
    28         <i class="fa fa-lightbulb-o fa-2x" *ngIf="korona">{{korona[0].deathsMK}}</i>
     28        <i class="fa fa-lightbulb-o fa-2x" *ngIf="korona">{{korona.deathsMK}}</i>
    2929        <h2 class="timer count-title count-number"></h2>
    3030        <p class="count-text ">Смртни случаи во земјата</p>
     
    3333    <div class="col">
    3434      <div class="counter">
    35         <i class="fa fa-bug fa-2x" *ngIf="korona">{{korona[0].newMK}}</i>
     35        <i class="fa fa-bug fa-2x" *ngIf="korona">{{korona.newMK}}</i>
    3636        <h2 class="timer count-title count-number"></h2>
    3737        <p class="count-text ">Нови случаи во земјата</p>
     
    4242    <div class="col">
    4343      <div class="counter">
    44         <i class="fa fa-bug fa-2x" *ngIf="korona">{{korona[0].totalGlobal}}</i>
     44        <i class="fa fa-bug fa-2x" *ngIf="korona">{{korona.totalGlobal}}</i>
    4545        <h2 class="timer count-title count-number"></h2>
    4646        <p class="count-text ">Вкупно случаи глобално</p>
     
    4949    <div class="col">
    5050      <div class="counter">
    51         <i class="fa fa-bug fa-2x" *ngIf="korona">{{korona[0].activeGlobal}}</i>
     51        <i class="fa fa-bug fa-2x" *ngIf="korona">{{korona.activeGlobal}}</i>
    5252        <h2 class="timer count-title count-number"></h2>
    5353        <p class="count-text ">Активни случаи глобално</p>
     
    5656    <div class="col">
    5757      <div class="counter">
    58         <i class="fa fa-bug fa-2x" *ngIf="korona">{{korona[0].deathsGlobal}}</i>
     58        <i class="fa fa-bug fa-2x" *ngIf="korona">{{korona.deathsGlobal}}</i>
    5959        <h2 class="timer count-title count-number"></h2>
    6060        <p class="count-text ">Смртни случаи глобално</p>
  • 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.