嗨,我在从自定义 ng 模块创建表时收到以下错误,
Q1:无法理解错误内容 Q2:模块在其他地方工作,所以可能我是那个遗漏了可能是什么的人
ERROR Error: Uncaught (in promise): NullInjectorError: R3InjectorError(ProjectsModule)[InjectionToken _ViewRepeater -> InjectionToken _ViewRepeater -> InjectionToken _ViewRepeater -> InjectionToken _ViewRepeater]:
NullInjectorError: No provider for InjectionToken _ViewRepeater!
NullInjectorError: R3InjectorError(ProjectsModule)[InjectionToken _ViewRepeater -> InjectionToken _ViewRepeater -> InjectionToken _ViewRepeater -> InjectionToken _ViewRepeater]:
NullInjectorError: No provider for InjectionToken _ViewRepeater!
at NullInjector.get (core.js:11077)
at R3Injector.get (core.js:11243)
at R3Injector.get (core.js:11243)
at R3Injector.get (core.js:11243)
at NgModuleRef$1.get (core.js:25334)
at R3Injector.get (core.js:11243)
at NgModuleRef$1.get (core.js:25334)
at Object.get (core.js:25048)
at lookupTokenUsingModuleInjector (core.js:3342)
at getOrCreateInjectable (core.js:3454)
at resolvePromise (zone.js:1213)
at resolvePromise (zone.js:1167)
at zone.js:1279
at ZoneDelegate.invokeTask (zone.js:406)
at Object.onInvokeTask (core.js:28654)
at ZoneDelegate.invokeTask (zone.js:405)
at Zone.runTask (zone.js:178)
at drainMicroTaskQueue (zone.js:582)
at ZoneTask.invokeTask [as invoke] (zone.js:491)
at invokeTask (zone.js:1600)
component.html
<table cng-table></table
component.ts
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { ConfigurationGroup } from 'src/app/interfaces/configurationGroup';
@Component({
selector: 'app-configuration',
templateUrl: './configuration.component.html',
styleUrls: ['./configuration.component.css']
})
export class ConfigurationComponent implements OnInit {
public routeParams!: Object;
public configurationGroups!: ConfigurationGroup[];
constructor(private route: ActivatedRoute) {
fetch('../assets/names.json')
.then(response => response.text())
.then(data => {
this.configurationGroups = JSON.parse(data);
});
}
ngOnInit(): void {
this.routeParams = this.route.snapshot.params;
}
}
module.ts 插入了 cng-table 模块,但它的代码很长并且适用于其他组件