装饰器不支持函数调用,但在'NgModule'中调用了'?makeDecorator''NgModule'调用了'?makeDecorator'

Hud*_*fik 6 angular

我正在尝试此链接中的所有解决方案:

https://stack247.wordpress.com/2018/09/07/angular-all-possible-solutions-for-no-ngmodule/

似乎没有什么用,当我尝试使用ng b --prod时会发生这种情况 。我无法理解该错误。

装饰器不支持函数调用,但在'NgModule'中调用了'?makeDecorator''NgModule'调用了'?makeDecorator'

码:

import { BrowserModule } from '@angular/platform-browser';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';

import { NgModule } from '@angular/Core';
import { Route, RouterModule } from '@angular/router';

import { APP_BASE_HREF } from '@angular/common'
import { HttpClientModule } from '@angular/common/http';

import { SocialLoginModule,
         AuthServiceConfig,
         GoogleLoginProvider } from 'angular5-social-login';
import { NgbModule,
         NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
import { CookieService } from 'ngx-cookie-service';

import { AppComponent } from './app.component';
import { LoginComponent } from './login/login.component';
import { HomeComponent,
         NgbdModalsuccess,
         NgbdModaluploadfailed } from './home/Home.component'
import { User } from './commen/user';
import { Image } from './commen/image';

export const ROUTES: Route[] = [
  { path: '', component: LoginComponent },
  { path: 'home', component: HomeComponent }
]

const config = new AuthServiceConfig([
  {
    id: GoogleLoginProvider.PROVIDER_ID,
    provider: new GoogleLoginProvider('810260133980-m5ga3v7sglugi287eu2r0215p06e8gln.apps.googleusercontent.com')
  }
])

export function ProvideConfig() {
  return config;
}

@NgModule({
  declarations: [
    AppComponent,
    LoginComponent,
    HomeComponent,
    NgbdModalsuccess,
    NgbdModaluploadfailed,
  ],

  imports: [
    BrowserModule,
    RouterModule.forRoot(ROUTES),
    SocialLoginModule,
    HttpClientModule,
    NgbModule,
  ],

  providers: [
    { provide: 'ROUTES', useValue: ROUTES },
    { provide: APP_BASE_HREF, useValue : '/' },
    { provide: AuthServiceConfig, useFactory: ProvideConfig },

    CookieService,
    User,
    Image,
    BrowserAnimationsModule,
    NgbActiveModal,
  ],

  entryComponents:[
    NgbdModaluploadfailed,
    NgbdModalsuccess
  ],
  exports: [ RouterModule ],
  bootstrap: [ AppComponent ]
})

export class AppModule {

}
Run Code Online (Sandbox Code Playgroud)

小智 3

我今天也遇到了同样的问题。

在上面的代码中检查第 3 行导入:

import { NgModule } from '@angular/Core';
Run Code Online (Sandbox Code Playgroud)

系统模块名称区分大小写。将其更新为以下内容:

import { NgModule } from '@angular/core';
Run Code Online (Sandbox Code Playgroud)

这样问题就解决了。