I use Angular Google Maps (latest @agm/core), but I can’t get it panToor setCenterfor work, it just doesn’t do anything.
I import GoogleMapsAPIWrapperas follows:
import { GoogleMapsAPIWrapper } from '@agm/core';
Then I insert it into my constructor:
constructor(
injector: Injector,
private _wrapper: GoogleMapsAPIWrapper
){
super(injector);
}
Then I try to call the above method in a function like this:
resetMap():void
{
this._wrapper.setCenter({lat:53.097900,
lng:-1.661963});
this._wrapper.panTo({lat:53.097900,
lng:-1.661963});
}
I also tried to reference the map as a ViewChild of type AgmMap, but there is no public property for setCenter or panTo, as shown below:
@ViewChild('agmMap') agmMap:AgmMap;
Is there a way that I can reference directly the google map control instead of the Angular shell?
Please, can someone tell me what I am doing wrong? or how should I refer to a map to invoke methods against it.