angular2-google-maps

Angular 2 agm library for google maps setting place by place id

[亡魂溺海] 提交于 2019-12-30 08:24:30
问题 I am implementing in a page a google map where a place id is passed to me, I then need to obtain such place id and load the map with that marker. I was going through the documentation but its not clear on how i can target the map object from the <agm-map> tag so that i can set the place id. Here is part of the code: public latitude: number; public longitude: number; public zoom: number; public placeid: string; constructor( private mapsAPILoader: MapsAPILoader, private ngZone: NgZone ) {}

ngfor with agm-circle throws error : Angular2

风格不统一 提交于 2019-12-11 17:33:51
问题 I am using agm ( angular google maps ) and want to draw n number of circles using ngfor but i am getting an error : Can't bind to 'ngFor' since it isn't a known property of 'agm-circle'. this is my html: <agm-circle *ngFor="data in circles" [latitude]="data.lat" [longitude]="data.lng" [circleDraggable]="true" [editable]="true" [fillColor]="'data.color'" [radius]="data.radius" > </agm-circle> this is my ts file having data: lat: number; lng: number; circle: any; @ViewChild(AgmPolygon) polygon:

setCenter not working in angular2-google-maps

别来无恙 提交于 2019-12-03 03:54:44
问题 import { GoogleMapsAPIWrapper } from '@agm/core'; import { Component, Input } from '@angular/core'; @Component({ selector: 'core-map', styleUrls: [ './map.component.scss' ], templateUrl: './map.component.html', }) export class MapComponent { constructor( public gMaps: GoogleMapsAPIWrapper ) {} public markerClicked = (markerObj) => { this.gMaps.setCenter({ lat: markerObj.latitude, lng: markerObj.longitude }); console.log('clicked', markerObj, { lat: markerObj.latitude, lng: markerObj.longitude

setCenter not working in angular2-google-maps

天大地大妈咪最大 提交于 2019-12-02 17:18:49
import { GoogleMapsAPIWrapper } from '@agm/core'; import { Component, Input } from '@angular/core'; @Component({ selector: 'core-map', styleUrls: [ './map.component.scss' ], templateUrl: './map.component.html', }) export class MapComponent { constructor( public gMaps: GoogleMapsAPIWrapper ) {} public markerClicked = (markerObj) => { this.gMaps.setCenter({ lat: markerObj.latitude, lng: markerObj.longitude }); console.log('clicked', markerObj, { lat: markerObj.latitude, lng: markerObj.longitude }); } } console output: Object {lat: 42.31277, lng: -91.24892} Also have tried panTo with the same

Angular 2 agm library for google maps setting place by place id

删除回忆录丶 提交于 2019-12-01 03:49:49
I am implementing in a page a google map where a place id is passed to me, I then need to obtain such place id and load the map with that marker. I was going through the documentation but its not clear on how i can target the map object from the <agm-map> tag so that i can set the place id. Here is part of the code: public latitude: number; public longitude: number; public zoom: number; public placeid: string; constructor( private mapsAPILoader: MapsAPILoader, private ngZone: NgZone ) {} ngOnInit() { //set google maps defaults this.zoom = 4; this.latitude = 39.8282; this.longitude = -98.5795;

Angular2 Cannot find namespace 'google'

时光总嘲笑我的痴心妄想 提交于 2019-11-28 20:19:57
I am working with angular2-google-maps and latest version of Angular2. I am trying to convert some of the local map component functions into services in their own file maps.service.ts . For example: map.component.ts getGeoLocation(lat: number, lng: number) { if (navigator.geolocation) { let geocoder = new google.maps.Geocoder(); let latlng = new google.maps.LatLng(lat, lng); let request = { latLng: latlng }; geocoder.geocode(request, (results, status) => { if (status == google.maps.GeocoderStatus.OK) { let result = results[0]; if (result != null) { this.fillInputs(result.formatted_address); }

Angular2 Cannot find namespace 'google'

孤者浪人 提交于 2019-11-27 19:20:11
问题 I am working with angular2-google-maps and latest version of Angular2. I am trying to convert some of the local map component functions into services in their own file maps.service.ts . For example: map.component.ts getGeoLocation(lat: number, lng: number) { if (navigator.geolocation) { let geocoder = new google.maps.Geocoder(); let latlng = new google.maps.LatLng(lat, lng); let request = { latLng: latlng }; geocoder.geocode(request, (results, status) => { if (status == google.maps