简体   繁体   中英

Error importing PopupModule.forRoot()

I have a working angular 2 project. 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. I have installed it using npm install ng2-opd-popup .

vendor.9f5a936….js:253
Uncaught SyntaxError {_nativeError: Error: Unexpected value '[object Object]' imported by the module 'AppModule' at SyntaxError.Base…}

Any help would be appreciated. By the way I am following this link for popup component and I am using webpack.

Part of app.module.ts file:

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. it is not needed. after it, everything is worked ok.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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