Skip to content

Instantly share code, notes, and snippets.

@zrod
Created August 17, 2017 21:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zrod/a855e5cc3bd8640c330df3079a4b1d93 to your computer and use it in GitHub Desktop.
Save zrod/a855e5cc3bd8640c330df3079a4b1d93 to your computer and use it in GitHub Desktop.
<div>
<h1>{{pousada.title}}</h1>
<small>{{pousada.location}}</small>
<iframe
width="600"
height="450"
frameborder="0" style="border:0"
src="https://www.google.com/maps/embed/v1/place?key={{googleMapsKey}}
&q=Space+Needle,Seattle+WA" allowfullscreen
></iframe>
</div>
import 'rxjs/add/operator/switchMap';
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute, ParamMap } from '@angular/router';
import { Pousada } from '../../services/pousada/pousada';
import { PousadaService } from '../../services/pousada/pousada.service';
@Component({
selector: 'pousada',
templateUrl: './pousada-detail.component.html'
})
export class PousadaDetailComponent implements OnInit {
pousada: Pousada;
embedParams: string;
googleMapsKey: string;
constructor(
private pousadaService: PousadaService,
private route: ActivatedRoute
) {
this.embedParams = '365m/data=!3m1!1e3';
this.googleMapsKey = 'abc';
}
ngOnInit(): void {
this.route.paramMap
.switchMap((params: ParamMap) => this.pousadaService.getRecord(params.get('slug')))
.subscribe(pousada => this.pousada = pousada);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment