I'm using Angular Google Maps (latest @agm/core
) but can't get panTo
or setCenter
to work it simply does nothing.
I import GoogleMapsAPIWrapper
like this:
import { GoogleMapsAPIWrapper } from '@agm/core';
I then inject it into my constructor:
constructor(
injector: Injector,
private _wrapper: GoogleMapsAPIWrapper
){
super(injector);
}
Then I try to call the above method in a function like so:
resetMap():void
{
this._wrapper.setCenter({lat:53.097900,
lng:-1.661963});
this._wrapper.panTo({lat:53.097900,
lng:-1.661963});
}
I have also tried referencing the map as a ViewChild of type AgmMap but there is no public property to setCenter or panTo, as below;
@ViewChild('agmMap') agmMap:AgmMap;
Is there a way I can reference the google map control directly instead of the angular wrapper?
Please can anyone advise what I'm doing wrong? or how I am meant to reference the map to call methods against it.