运行时错误 ng-select-selection-model -

ads*_*sds 5 select package.json angular-ngselect angular

我的目的是使用这个选择

在我的延迟加载模块中我这样做:

imports: [
        CommonModule,
        FormsModule,    
        NgSelectModule        

    ],
    providers: []
Run Code Online (Sandbox Code Playgroud)

模板:

<ng-select [items]="list" [bindLabel]="TIPE" bindValue="id" [(ngModel)]="tipe" (onChange)="changeValue($event)" >
            </ng-select>
Run Code Online (Sandbox Code Playgroud)

当用户走这条路线时,它会在控制台中打印以下错误:

:

 Uncaught (in promise): NullInjectorError: R3InjectorError(AppModule)[InjectionToken ng-select-selection-model -> InjectionToken ng-select-selection-model -> InjectionToken ng-select-selection-model]: 
  NullInjectorError: No provider for InjectionToken ng-select-selection-model!
NullInjectorError: R3InjectorError(AppModule)[InjectionToken ng-select-selection-model -> InjectionToken ng-select-selection-model -> InjectionToken ng-select-selection-model]: 
  NullInjectorError: No provider for InjectionToken ng-select-selection-model!
Run Code Online (Sandbox Code Playgroud)

我不明白为什么,有人可以帮助我吗?

Gim*_*mly 9

我遇到了同样的问题,我NgSelectModule在主应用程序模块和组件模块中导入了它并修复了。

您可能还想看看这个