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

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

primeNG components

  • Property mode set to 100644
File size: 1.5 KB
RevLine 
[e29cc2e]1import { Component, OnInit, ViewEncapsulation } from '@angular/core';
[59329aa]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
[e29cc2e]19 constructor(private route: ActivatedRoute, private router: Router, private locationService: LocationService,
20 private imagesService: ImagesService) {
[59329aa]21 this.locationId = 1;
22 this.locationDetails = new Location();
23 this.images = [];
[e29cc2e]24 }
[59329aa]25
[e29cc2e]26 responsiveOptions:any[] = [
27 {
[59329aa]28 breakpoint: '1024px',
29 numVisible: 5
30 },
31 {
32 breakpoint: '768px',
33 numVisible: 3
34 },
35 {
36 breakpoint: '560px',
37 numVisible: 1
38 }
[e29cc2e]39];
[59329aa]40 ngOnInit(): void {
41 this.route.queryParams
[e29cc2e]42 .subscribe(params => {
43 this.locationId = params.id;
44 });
[59329aa]45
46 this.locationService.getLocation(this.locationId).subscribe(
47 data => {
[e29cc2e]48 this.locationDetails = data;
[59329aa]49 }
50 );
[e29cc2e]51
[59329aa]52 this.imagesService.getAllImagesForLocation(this.locationId).subscribe(
53 image => {
[e29cc2e]54 this.images = image;
[59329aa]55 }
[e29cc2e]56 );
[59329aa]57 }
58
[e29cc2e]59
[59329aa]60}
Note: See TracBrowser for help on using the repository browser.