source: trip-planner-front/src/app/location/location.component.ts@ 6a3a178

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
Line 
1import { Component, OnInit } from '@angular/core';
2import { Category } from '../_models/category';
3import { City } from '../_models/city';
4import { Companion } from '../_models/companion';
5import { Country } from '../_models/country';
6import { CategoryService } from '../_services/cateogry.service';
7import { CityService } from '../_services/city.service';
8import { CompanionService } from '../_services/companion.service';
9import { CountryService } from '../_services/country.service';
10
11@Component({
12 selector: 'app-location',
13 templateUrl: './location.component.html',
14 styleUrls: ['./location.component.css']
15})
16export 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.