Ignore:
Timestamp:
07/27/20 15:36:14 (4 years ago)
Author:
Mile Jankuloski <mile.jankuloski@…>
Branches:
master
Children:
d2e69be
Parents:
de2baac
Message:

Connecting front to back

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

Legend:

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

    rde2baac r4b342bb  
    1 <!-- <h1>Counter</h1>
    2 
    3 <p>This is a simple example of an Angular component.</p>
    4 
    5 <p aria-live="polite">Current count: <strong>{{ currentCount }}</strong></p>
    6 
    7 <button class="btn btn-primary" (click)="incrementCounter()">Increment</button> -->
    8 
    91<app-nav-menu></app-nav-menu>
    102
     
    135    <h2>Здравствени установи</h2>
    146    <input type="text" class="form-control" name="lek" placeholder="Пронајди лек">
    15     <table class='table table-striped table-bordered table-sm' cellspacing="0" width="100%" aria-labelledby="tableLabel" *ngIf="true">
     7    <table class='table table-striped table-bordered table-sm' cellspacing="0" width="100%" aria-labelledby="tableLabel" *ngIf="facilities">
    168        <thead>
    179            <tr>
    18             <th>Placeholder1</th>
    19             <th>Placeholder2</th>
    20             <th>Placeholder3</th>
    21             <th>Placeholder4</th>
     10            <th>Име</th>
     11            <th>Општина</th>
     12            <th>Адреса</th>
     13            <th>Тип на установа</th>
     14            <th>Е-пошта</th>
     15            <th>Телефон</th>
    2216            </tr>
    2317        </thead>
    2418        <tbody>
    25             <tr *ngFor="">
    26             <td>data1</td>
    27             <td>data2</td>
    28             <td>data3</td>
    29             <td>data4</td>
     19            <tr *ngFor="let facility of facilities">
     20            <td>{{ facility.Name }}</td>
     21            <td>{{ facility.Municipality }}</td>
     22            <td>{{ facility.Address }}</td>
     23            <td>{{ facility.Type }}</td>
     24            <td>{{ facility.Email }}</td>
     25            <td>{{ facility.Phone }}</td>
    3026            </tr>
    3127        </tbody>
  • Farmatiko/ClientApp/src/app/counter/counter.component.ts

    rde2baac r4b342bb  
    1 import { Component } from '@angular/core';
    2 
     1import { Component, Inject } from '@angular/core';
     2import { HttpClient } from '@angular/common/http';
     3import { HealthFacilities } from '../models/HealthFacilities';
    34@Component({
    45  selector: 'app-counter-component',
     
    78})
    89export class CounterComponent {
    9   public currentCount = 0;
     10  public facilities: HealthFacilities[];
    1011
    11   public incrementCounter() {
    12     this.currentCount++;
    13   }
     12  constructor(http: HttpClient, @Inject('BASE_URL') baseUrl: string) {
     13    http.get<HealthFacilities[]>(baseUrl + 'HealthFacilities').subscribe(result => {
     14      this.facilities = result;
     15    }, error => console.error(error));
     16  }
    1417}
Note: See TracChangeset for help on using the changeset viewer.