other
related
questions
已经工作或申请了,我就把这个留在这里。
[object ErrorEvent] thrown
Jasmine窗口中出现错误,控制台中出现相应错误:
Uncaught Error: Uncaught (in promise): Error: Cannot match any routes. URL Segment: 'members'
Error: Cannot match any routes. URL Segment: 'members'
at ApplyRedirects.push../node_modules/@angular/router/fesm5/router.js.ApplyRedirects.noMatchError
...
与OP一样,错误中引用的路径
在规范或规范所属的组件中没有引用
紧接着之前
RouterTestingModule.withRoutes
打电话。
TLDR公司:
如果你有
第一部分
,
和
,但第三个组件在与上述情况类似的情况下发生故障,则
检查
路由器测试模块.withRoutes
导入缺少的路由。例如
...
describe('SecondComponent', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports: [
RouterTestingModule.withRoutes([{path:'missing/path',component:SecondComponent}])
],
declarations: [ SecondComponent ]
})
})
...
})
@Component({selector:'app-second',template:''})
class SecondComponent {}