如何使用AgmMaps进行反向地理编码? 使用经度和纬度获取街道地址? 应该导入什么,功能代码应该是什么?
appmodule.ts
import { AgmCoreModule } from '@agm/core';
imports: [
AgmCoreModule.forRoot({
apiKey: 'apikey',
}),
]
app.Component.css
agm-map {
height: 600px;
}
app.Component.ts
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit{
title = 'app';
ngOnInit() {
}
latitude = 3.3333;
longitude = 7.7777;
*// Reverse geocoding function here*
}
app.Component.html
<agm-map [latitude]="latitude" [longitude]="longitude">
</agm-map>