Last change
on this file since 6a3a178 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
1.5 KB
|
Rev | Line | |
---|
[6a3a178] | 1 | import { Component, OnInit } from '@angular/core';
|
---|
| 2 | import { Category } from '../_models/category';
|
---|
| 3 | import { City } from '../_models/city';
|
---|
| 4 | import { Companion } from '../_models/companion';
|
---|
| 5 | import { Country } from '../_models/country';
|
---|
| 6 | import { CategoryService } from '../_services/cateogry.service';
|
---|
| 7 | import { CityService } from '../_services/city.service';
|
---|
| 8 | import { CompanionService } from '../_services/companion.service';
|
---|
| 9 | import { CountryService } from '../_services/country.service';
|
---|
| 10 |
|
---|
| 11 | @Component({
|
---|
| 12 | selector: 'app-location',
|
---|
| 13 | templateUrl: './location.component.html',
|
---|
| 14 | styleUrls: ['./location.component.css']
|
---|
| 15 | })
|
---|
| 16 | export class LocationComponent implements OnInit {
|
---|
| 17 |
|
---|
| 18 | categories: Category[];
|
---|
| 19 | cities: City[];
|
---|
| 20 | countries:Country[];
|
---|
| 21 | companions: Companion[];
|
---|
| 22 | constructor(private categoryService: CategoryService, private cityService : CityService,
|
---|
| 23 | private countryService : CountryService, private companionService : CompanionService) {
|
---|
| 24 | this.categories = [];
|
---|
| 25 | this.cities=[];
|
---|
| 26 | this.countries = [];
|
---|
| 27 | this.companions = [];
|
---|
| 28 | }
|
---|
| 29 |
|
---|
| 30 | ngOnInit(): void {
|
---|
| 31 | this.categoryService.getAllCategories().subscribe(
|
---|
| 32 | data => {
|
---|
| 33 | this.categories = data;
|
---|
| 34 | console.log(data);
|
---|
| 35 | }
|
---|
| 36 | );
|
---|
| 37 | this.cityService.getAllCities().subscribe(
|
---|
| 38 | data => {
|
---|
| 39 | this.cities = data;
|
---|
| 40 |
|
---|
| 41 | }
|
---|
| 42 | );
|
---|
| 43 | this.countryService.getAllCountries().subscribe(
|
---|
| 44 | data => {
|
---|
| 45 | this.countries = data;
|
---|
| 46 | }
|
---|
| 47 | );
|
---|
| 48 |
|
---|
| 49 | this.companionService.getAllCompanions().subscribe(
|
---|
| 50 | data => {
|
---|
| 51 | this.companions = data;
|
---|
| 52 | }
|
---|
| 53 | );
|
---|
| 54 | }
|
---|
| 55 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.