小编Mau*_*oni的帖子

在URL Angular 2+上隐藏路线

所以我试图在网址上隐藏我的路线,这意味着我希望我的应用程序始终将网址显示为在根应用程序中,例如:

"www.foo.com"

代替

"www.foo.com/login"

它有什么方法可以在角度2中实现这一点?

在此先感谢您的帮助!

angular angular-router

3
推荐指数
1
解决办法
4463
查看次数

不能从事件侦听器/ Angular 2的函数内部访问变量

我正在使用Google Maps API v3,并且在我的地图上有一些多边形。我试图添加一个事件,单击将其全部删除,并在该事件的回调函数中调用另一个函数,但我不断收到TypeError:无法读取第64行上未定义的属性“ length”(即在事件侦听器及其告诉中我没有定义Polys数组)。另外,如果我尝试在侦听器中添加一个函数,它将无法识别它,我认为它与范围问题有关,但我不知道如何解决它。我在这里先向您的帮助表示感谢。

export class InicioComponent implements OnInit, AfterViewInit {

  locaciones: Locacion[] = [];
  regiones: Region[];
  polys: any[] = [];
  constructor(private locacionService: LocacionService, private router: Router) { }

  getLocaciones(): void {
    this.locacionService.getLocaciones().then(locaciones => this.locaciones = locaciones);
  }

   public loadLocaciones(router: Router) {
    for (let i = 0; i < this.locaciones.length; i++) {
      const marker = new google.maps.Marker({
        position: new google.maps.LatLng(this.locaciones[i].latitud, this.locaciones[i].longitud),
        map: map,
        label: {
          color: 'black',
          fontWeight: 'bold',
          text: this.locaciones[i].nombre,
        },
        idLocacion: this.locaciones[i].id
      });
      google.maps.event.addListener(marker, 'click',() => { …
Run Code Online (Sandbox Code Playgroud)

google-maps scope angular

1
推荐指数
1
解决办法
578
查看次数

标签 统计

angular ×2

angular-router ×1

google-maps ×1

scope ×1