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

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

primeNG components

  • Property mode set to 100644
File size: 1.5 KB
Line 
1import { Component, OnInit, ViewEncapsulation } from '@angular/core';
2import { ActivatedRoute, Router } from '@angular/router';
3import { Images } from 'src/app/_models/images';
4import { Location } from 'src/app/_models/location';
5import { ImagesService } from 'src/app/_services/images.service';
6import { LocationService } from 'src/app/_services/location.service';
7
8@Component({
9 selector: 'app-location-details',
10 templateUrl: './location-details.component.html',
11 styleUrls: ['./location-details.component.css']
12})
13export class LocationDetailsComponent implements OnInit {
14
15 locationId: number;
16 locationDetails: Location;
17 images: Images[];
18
19 constructor(private route: ActivatedRoute, private router: Router, private locationService: LocationService,
20 private imagesService: ImagesService) {
21 this.locationId = 1;
22 this.locationDetails = new Location();
23 this.images = [];
24 }
25
26 responsiveOptions:any[] = [
27 {
28 breakpoint: '1024px',
29 numVisible: 5
30 },
31 {
32 breakpoint: '768px',
33 numVisible: 3
34 },
35 {
36 breakpoint: '560px',
37 numVisible: 1
38 }
39];
40 ngOnInit(): void {
41 this.route.queryParams
42 .subscribe(params => {
43 this.locationId = params.id;
44 });
45
46 this.locationService.getLocation(this.locationId).subscribe(
47 data => {
48 this.locationDetails = data;
49 }
50 );
51
52 this.imagesService.getAllImagesForLocation(this.locationId).subscribe(
53 image => {
54 this.images = image;
55 }
56 );
57 }
58
59
60}
Note: See TracBrowser for help on using the repository browser.