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

Last change on this file since fa375fe was fa375fe, checked in by Ema <ema_spirova@…>, 3 years ago

adding new components

  • Property mode set to 100644
File size: 1.2 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 companions: Companion[];
20 constructor(private categoryService: CategoryService, private companionService : CompanionService) {
21 this.categories = [];
22 this.companions = [];
23 }
24
25 ngOnInit(): void {
26 this.categoryService.getAllCategories().subscribe(
27 data => {
28 this.categories = data;
29 console.log(data);
30 }
31 );
32
33 this.companionService.getAllCompanions().subscribe(
34 data => {
35 this.companions = data;
36 }
37 );
38 }
39}
Note: See TracBrowser for help on using the repository browser.