Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/27.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
路由器在angular6位置不工作_Angular_Location_Router - Fatal编程技术网

路由器在angular6位置不工作

路由器在angular6位置不工作,angular,location,router,Angular,Location,Router,路由器在angular6位置不工作。 我的代码如下。怀疑会值得一个地方吗 handleBackButtonPress() { this.subscription = this.location.subscribe(redirect => { if (redirect.pop === true) { alert('this is a backbutton click'); this.router.navigate(['/users/me/w

路由器在angular6位置不工作。 我的代码如下。怀疑会值得一个地方吗

handleBackButtonPress() {
    this.subscription = this.location.subscribe(redirect => {
      if (redirect.pop === true) {
        alert('this is a backbutton click');
        this.router.navigate(['/users/me/watches']);
      }
    });
  }
我在每个文件夹中管理我的路由器,下面的代码定义了我要移动的路由器

import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';

import { Resolver } from './resolver.service';

const routes: Routes = [
  { path: 'home', loadChildren: '../home/home.module#HomeModule' }
];

@NgModule({
  exports: [RouterModule],
  imports: [RouterModule.forChild(routes)],
  providers: [Resolver]
})
export class RoutingModule {}

问题是什么error@Sajeetharan收到警报后,路由器工作不正常。无法转到URL时出现问题。您在哪里定义了路由?你能分享你的路线吗code@SehaxX我更新了上面关于路由器的问题。谢谢。但是我想知道我们是否不需要在路线方面申报。它(this.router.navigate)可以很好地移动到未声明的路径。