StaticInjectorError(a)[t -> t]: NullInjectorError: No provider for t

纵然是瞬间 提交于 2019-12-24 05:26:46

问题


I am using Angular 8 with Electron to build a desktop application. I am using nebular theme and have created 2 custom modules and so far they are working fine but i created a sharedModule to export a component from one module for another module but on clicking the respective component making use of that shared Module it started showing me this error

StaticInjectorError(a)[t -> t]: StaticInjectorError(Platform: core)[t -> t]: NullInjectorError: No provider for t! Here is my code

Shared Module

import { DropdownButtonsComponent } from '../ui-features/buttons/dropdown-buttons/dropdown-button.component';
import { NbCardModule } from '@nebular/theme';
import { NgModule } from '@angular/core';
import { ThemeModule } from '../../@theme/theme.module';

@NgModule({

    imports: [
      ThemeModule,
      NbCardModule
    ],
    exports: [
      DropdownButtonsComponent,
    ],
    declarations: [
      DropdownButtonsComponent,
    ],
    providers: [],
  })

  export class SharedModule { 
  }

Users Module

@NgModule({
    imports : [
        ThemeModule,
        NbCardModule,
        FormsModule, 
        UsersRoutingModule,
        SharedModule
      //  DropdownButtonsComponent
    ],
    declarations: [
        AllusersComponent, 
        UsersComponent, 
        AdduserComponent
    ]
})
export class UsersModule { }

Buttons Module

const components = [
  ButtonsComponent,
  ActionGroupsComponent,
  // DropdownButtonsComponent,
];

@NgModule({
  imports: [
    ThemeModule,
    SharedModule,
    NbCardModule
  ],
  exports: [
    ...components,
  ],
  declarations: [
    ...components,
  ],
  providers: [],
})
export class ButtonsModule { }

来源:https://stackoverflow.com/questions/57704138/staticinjectorerrorat-t-nullinjectorerror-no-provider-for-t

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!