Angular2 module has no exported member

前端 未结 10 1285
梦谈多话
梦谈多话 2020-12-29 01:09

For a website with authentication in Angular2, I want to use a component of the authentication submodule in the main app component. However, I keep getting the following err

10条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-29 01:58

    You do not need the line:

    import { SigninComponent, RegisterComponent } from './auth/auth.module';
    

    in your app.component.ts as you already included the AuthModule in your app.module.ts. AutModule import is sufficient to use your component in the app.

    The error that you get is a TypeScript error, not a Angular one, and it is correct in stating that there is no exported member, as it searches for a valid EC6 syntax for export, not angular module export. This line would thus work in your app.component.ts:

    import { SigninComponent } from './auth/components/signin.component';
    

提交回复
热议问题