Angular Native-script,Component是两个模块声明的一部分,即使仅在一个地方声明

时间:2020-03-30 04:23:39

标签: android angular nativescript angular-nativescript

所以在Angular Nativesript环境中这个持续存在的问题,我只在auth.module.tns.ts文件中声明了组件。

错误:

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 {
}

关于原因可能有什么建议?

0 个答案:

没有答案