gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-04 15:29:19 26 4
gpt4 key购买 nike

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

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

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

Function calls are not supported in decorators but 'ɵmakeDecorator' was called in 'NgModule' 'NgModule' calls 'ɵ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 {

}

最佳答案

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

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

import { NgModule } from '@angular/Core';

系统模块名称为 区分大小写 .将其更新为以下内容:
import { NgModule } from '@angular/core';

这解决了这个问题。

关于angular - 装饰器不支持函数调用,但在 'ɵmakeDecorator' 中调用了 'NgModule' 'NgModule' 调用 'ɵmakeDecorator',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54327037/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com