模块"TempModule"导入的异常值"DecoratorFactory" [英] Unexpected value 'DecoratorFactory' imported by the module 'TempModule'

查看:186
本文介绍了模块"TempModule"导入的异常值"DecoratorFactory"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在示例应用程序中,我编写了一个功能模块"TempModule",并且 下面是代码.

In my sample application I have written a feature module "TempModule" and below is the code.

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

import { TempOneComponent } from './temp.one.component';
import { TempTwoComponent } from './temp.two.component';
import { tempRouting } from './temp.routing';



@NgModule({
declarations: [ TempOneComponent,
                TempTwoComponent],
imports: [ NgModule,
           CommonModule,
           tempRouting]
})

export class TempModule {}

我指的是根模块中的TempModule,下面是根模块代码

I am referring to the TempModule in root module , below is the root module code

import { NgModule }       from '@angular/core';
import { BrowserModule  } from '@angular/platform-browser';
import { FormsModule } from '@angular/forms';

//-- routing import
import { routing,
         appRoutingProviders} from './app.routing'; 

//-- root component import
import { AppComponent } from './app.component';
import { AppAboutComponent } from './app-about.component';
import { AppCreatTicketComponent } from './tickets/    app.create-ticket.component';
import { AppOpenTicketComponent } from './tickets/app.open-ticket.component';
import { AppSearchTicketComponent } from './tickets/    app.search-ticket.component';
import { AppDashboardComponent } from './tickets/app.dashboard.component';
import { AppUsersComponent } from './users/app.users.component';

import { TempModule } from './tempModule/temp.module';

@NgModule({
    declarations: [AppComponent , 
    AppAboutComponent , 
    AppCreatTicketComponent,
    AppOpenTicketComponent,
    AppSearchTicketComponent,
    AppDashboardComponent,
    AppUsersComponent
    ],
    imports:       [BrowserModule ,
                    FormsModule ,
                    routing,
                    TempModule ],
    providers: [appRoutingProviders],
    bootstrap:    [AppComponent]

})

export class AppModule {}

运行应用程序时,在浏览器控制台中显示模块'TempModule'导入的意外值'DecoratorFactory'".

When I run the application , "Unexpected value 'DecoratorFactory' imported by the module 'TempModule'" is displayed in browser console.

任何想法都可能是导致此错误的原因吗?

Any idea what could be the reason for this error ?

推荐答案

您正试图在imports数组中导入decorator.它应该只包含模块

You're trying to import decorator in imports array. It should contain only modules

@NgModule({
  declarations: [ TempOneComponent,
                TempTwoComponent],
  imports: [ NgModule, <== why is it here???
           CommonModule,
           tempRouting]
}) 
export class TempModule {}

这篇关于模块"TempModule"导入的异常值"DecoratorFactory"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆