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

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

adding photos

  • 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 responsiveOptions;
19
20 constructor(private route: ActivatedRoute, private router: Router, private locationService : LocationService,
21 private imagesService : ImagesService) {
22 this.locationId = 1;
23 this.locationDetails = new Location();
24 this.images = [];
25
26 this.responsiveOptions = [
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 }
41
42
43 ngOnInit(): void {
44 this.route.queryParams
45 .subscribe(params => {
46 this.locationId = params.id;
47 });
48
49 this.locationService.getLocation(this.locationId).subscribe(
50 data => {
51 this.locationDetails = data;
52 }
53 );
54
55 this.imagesService.getAllImagesForLocation(this.locationId).subscribe(
56 image => {
57 this.images = image;
58 }
59 );
60 }
61
62
63}
Note: See TracBrowser for help on using the repository browser.