0

因此,在我仅在 auth.module.tns.ts 文件中声明组件的 Angular Nativesript 环境中,这个持续存在的问题。

错误:

Error: Type LoginComponent is part of the declarations of 2 modules: AuthModule and AuthModule! Please consider moving LoginComponent to a higher module that imports AuthModule and AuthModule. You can also create a new NgModule that exports and includes LoginComponent then import that NgModule in AuthModule and AuthModule. 

auth.module.ts 文件:

import {NgModule} from '@angular/core';
import {CommonModule} from '@angular/common';

import {AuthRoutingModule} from '../../views/auth/auth-routing.module';

@NgModule({
  declarations: [],
  imports: [
    CommonModule,
    AuthRoutingModule
  ]
})
export class AuthModule {
}

auth.module.tns.ts 文件:

import {NgModule, NO_ERRORS_SCHEMA} from '@angular/core';
import {NativeScriptCommonModule} from 'nativescript-angular/common';

import {AuthRoutingModule} from '../../views/auth/auth-routing.module';
import {LoginComponent} from '@src/app/views/auth/login/login.component';
import {SignupComponent} from '@src/app/views/auth/signup/signup.component';


@NgModule({
  declarations: [
    LoginComponent,
    SignupComponent
  ],
  imports: [
    AuthRoutingModule,
    NativeScriptCommonModule,
  ],
  exports: [],
  schemas: [NO_ERRORS_SCHEMA]
})
export class AuthModule {
}

关于原因可能是什么的任何建议?

4

0 回答 0