Open t-zander opened 5 years ago
Please provide example that does not work.
Case 1
@Component({ ... })
export class MyMapComponent {
center = { lat: 1; lng: 2 };
onClick() {
this.center = { lat: 45, lng, 45 };
}
<pre>{{center|json}}</pre>
<ngui-map #nguimap [center]="center"></ngui-map>
Case 2 Could we have a setCenter(position) or panTo(position) method? https://github.com/ng2-ui/map/blob/6df8377741b2257329954a5ce2490ecc0707a88a/src/components/ngui-map.component.ts#L153
This worked for me:
onMapReady($event) {
this.mapObject = $event.data.map;
}
onCenterClick() {
this.mapObject.setCenter({ // or .panTo(..)
lat: 43.7260366,
lng: -79.829754
});
}
IMPORTANT Please be specific with an example. An issue with no example or unclear requirements may be closed.
Steps to reproduce and a minimal demo Just try to perform this.map.setCenter({lat : anyNumber Here, lng: anyNumberHere}) as well as this.map.setZoom() It doesn't give any errors but it also doesn't work. Am I doing something wrong? What is the proper way to center my map programatically then?
Current behavior
Expected/desired behavior
Other information