简体   繁体   English

导入PopupModule.forRoot()时出错

[英]Error importing PopupModule.forRoot()

I have a working angular 2 project. 我有一个工作中的angular 2项目。 I need to make a popup form to fill in details in a table. 我需要制作一个弹出表单以在表格中填写详细信息。 Upon clicking a button I want to have a popup form wherein user can enter details and submit. 在单击按钮后,我想要一个弹出表单,用户可以在其中输入详细信息并提交。 For this I have been trying to use ng2-opd-popup component of Angular 2. But its throwing me following error when I added PopupModule.forRoot() in imports of @NgModule in my app.module.ts file. 为此,我一直在尝试使用Angular 2的ng2-opd-popup组件。但是,当我在我的app.module.ts文件的@NgModule imports中添加PopupModule.forRoot()时,它使我PopupModule.forRoot()了以下错误。 I have installed it using npm install ng2-opd-popup . 我已经使用npm install ng2-opd-popup安装了它。

vendor.9f5a936….js:253 vendor.9f5a936….js:253
Uncaught SyntaxError {_nativeError: Error: Unexpected value '[object Object]' imported by the module 'AppModule' at SyntaxError.Base…} 未捕获的SyntaxError {_nativeError:错误:模块'AppModule'在SyntaxError.Base处导入的意外值'[object Object]'}

Any help would be appreciated. 任何帮助,将不胜感激。 By the way I am following this link for popup component and I am using webpack. 顺便说一下,我正在跟踪此链接的弹出组件,而我正在使用webpack。

Part of app.module.ts file: app.module.ts文件的一部分:

import { BrowserModule } from '@angular/platform-browser';
import { FormsModule }    from '@angular/forms';
import { HttpModule } from '@angular/http';
import { AppComponent } from './app.component';
import { AgGridModule } from 'ag-grid-ng2/main';
import { PopupModule } from 'ng2-opd-popup';

@NgModule({
    imports: [
        BrowserModule,
        FormsModule,
        HttpModule,
        AgGridModule.forRoot(),
        PopupModule.forRoot(),
    ],
    declarations: [
        AppComponent,
    ],

I had the same problem, you need to go inside your ng2-opd-popup folder and delete the node_modules folder inside there. 我遇到了同样的问题,您需要进入ng2-opd-popup文件夹,然后删除其中的node_modules文件夹。 it is not needed. 不需要。 after it, everything is worked ok. 之后,一切正常。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM