angular6 Cannot read property 'split' of undefined

我遇到这个问题一般都是路由配置有误,我的导航是这样

this.router.navigate(["home/ecoloMenu/ecologyEvaluation/ecologicalFactors/mountain/greenRate"]);

到ecologyEvaluation这一层的时候,写错了配置

 

const routes: Routes = [
  {
    path: "",
    children: [

      {
        path: "ecologicalFactors",
        loadChildren:
          "app/ecology-evaluation/ecological-factors/ecological-factors.module#EcologicalFactorsModule"
      },

    ]
  }
];

其实没有componet作为主,把外边path和children去掉就好

const routes: Routes = [
      {
        path: "ecologicalFactors",
        loadChildren:
          "app/ecology-evaluation/ecological-factors/ecological-factors.module#EcologicalFactorsModule"
      },

    ]

 

你可能感兴趣的:(angular4,前端问题)