Path 如何从google autocomplete place angular 2路由参数纬度和经度?

Path 如何从google autocomplete place angular 2路由参数纬度和经度?,path,angular2-routing,Path,Angular2 Routing,我使用的是angular 2,在这部分(主页)中,我有一个google autocomplete place输入,如果你点击它,它会进入另一个页面(地图),它会显示用户在上一页单击的纬度和经度的地图。但关键是我想在URL中显示lat和long。这对我来说很复杂,不知道该怎么做,我也读过但不明白 app-routing.module: import { NgModule } from '@angular/core'; import { RouterModule, Route

我使用的是angular 2,在这部分(主页)中,我有一个google autocomplete place输入,如果你点击它,它会进入另一个页面(地图),它会显示用户在上一页单击的纬度和经度的地图。但关键是我想在URL中显示lat和long。这对我来说很复杂,不知道该怎么做,我也读过但不明白

app-routing.module:

import { NgModule }             from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { HomeComponent }  from './home/home.component';
import { MapComponent }  from './search/map.component';

const routes: Routes = [
 { path: '', redirectTo: '/home', pathMatch: 'full' },
 { path: 'home',     component: HomeComponent },
 { path: 'map/'+this.latitude+','+this.longitude,     component: 
  MapComponent },
  ];

@NgModule({
imports: [ RouterModule.forRoot(routes) ],
exports: [ RouterModule ]
})
export class AppRoutingModule {}
在我这样写的路径中,我不知道是正确的还是错误的

home.html:

<div class="col-md-8 col-md-push-2 container search-location">
<div class="form-group">
<input id="search" placeholder="select place" 
 autocorrect="off" autocapitalize="off" spellcheck="off" type="text" 
 class="form-control"
       #search [formControl]="searchControl">
 </div>
 </div>
map.html:

<div class="col-md-8 col-md-push-2 container search-location">
<agm-map [latitude]="latitude" [longitude]="longitude" [scrollwheel]="true" 
[zoom]="zoom">
<agm-marker [latitude]="latitude" [longitude]="longitude"></agm-marker>
</agm-map>
</div>
`],, }) 导出类MapComponent实现OnInit{

private google:any;
private latitude: number;
private longitude: number;
private searchControl: FormControl;
private zoom: number;


ngOnInit(){

}
}
它与参数有关,但我不知道如何编写代码。 你能帮帮我吗,我很困惑。 多谢各位

import { Component, ElementRef, NgModule, NgZone, OnInit, ViewChild } from 
'@angular/core';
import { FormControl, FormsModule, ReactiveFormsModule } from 
"@angular/forms";
import { BrowserModule } from "@angular/platform-browser";
import { AgmCoreModule, MapsAPILoader } from '@agm/core';
import { Router } from '@angular/router';
import {} from '@types/googlemaps';
declare let google: any;

@Component({
selector: 'map',
templateUrl: './map.html',
styles: [`
agm-map {
  height: 300px;
}
private google:any;
private latitude: number;
private longitude: number;
private searchControl: FormControl;
private zoom: number;


ngOnInit(){

}
}