source: trip-planner-front/src/app/explore/explore-result/explore-result.component.ts@ 76712b2

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

search all locations by city or region

  • Property mode set to 100644
File size: 814 bytes
Line 
1import { Component, OnInit } from '@angular/core';
2import { ActivatedRoute } from '@angular/router';
3import { LocationService } from 'src/app/_services/location.service';
4
5@Component({
6 selector: 'app-explore-result',
7 templateUrl: './explore-result.component.html',
8 styleUrls: ['./explore-result.component.css']
9})
10export class ExploreResultComponent implements OnInit {
11
12 place: string;
13 allLocation: any[] = [];
14
15 constructor(private route: ActivatedRoute, private locationService : LocationService) {
16 this.place = '';
17 }
18
19 ngOnInit(): void {
20 this.route.queryParams
21 .subscribe(params => {
22 this.place = params.place;
23 }
24 );
25
26 this.locationService.getAllLocationsSearch(this.place).subscribe(
27 data => {
28 this.allLocation = data;
29 }
30 )
31 }
32
33}
Note: See TracBrowser for help on using the repository browser.