测试中添加RouterTestingModule
模块就可以解决
import { RouterTestingModule } from '@angular/router/testing';
...
beforeEach(() => TestBed.configureTestingModule({
imports: [ RouterTestingModule ]
}));
测试中添加RouterTestingModule
模块就可以解决
import { RouterTestingModule } from '@angular/router/testing';
...
beforeEach(() => TestBed.configureTestingModule({
imports: [ RouterTestingModule ]
}));
本文标题:angular 单元测试报错:NullInjectorError
本文链接:https://www.haomeiwen.com/subject/twqooktx.html
网友评论