angular - 导入 PopupModule.forRoot() 时出错

标签 angular typescript webpack popup

我有一个工作 Angular 2 项目。我需要制作一个弹出式表格来填写表格中的详细信息。单击一个按钮后,我想要一个弹出表单,用户可以在其中输入详细信息并提交。为此,我一直在尝试使用 Angular 2 的 ng2-opd-popup 组件。但是当我在 中添加 PopupModule.forRoot() 时,它抛出了以下错误在我的 app.module.ts 文件中导入 @NgModule。我已经使用 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…}

如有任何帮助,我们将不胜感激。顺便说一下,我正在关注 this link对于弹出组件,我正在使用 webpack。

部分 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,
    ],

最佳答案

我遇到了同样的问题,您需要进入 ng2-opd-popup 文件夹并删除其中的 node_modules 文件夹。不需要。之后,一切正常。

关于angular - 导入 PopupModule.forRoot() 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44436495/

相关文章:

Angular FormArray - AbstractControl 类型上不存在属性控件

typescript - 如何在 Typescript 中获取对象的哈希值?

css - Webpack CSS 模块和 Angular 模板

javascript - 带有 prod 参数的 webpack

node.js - 如何使用 process.hrtime.bigint

typescript - 使用 webpack 生成 bundle TypeScript 定义文件

angular - 如何从孙子路由到 child

Angular 4 : setting the local variable # dynamically

javascript - 如何推送设置了特定状态的数据?

typescript - 使用打字 d.ts 管理器 : How do you specify which source to use and why