首页 文章

错误:(SystemJS)XHR错误(404 Not Found)loading ng2-gridstack

提问于
浏览
0

我只是想在我的Angular2应用程序上安装ng2-gridstack模块 . 在全新安装中,我运行:

npm install gridstack (dependency)
npm install ng2-gridstack

只需按照instructions,但我得到如下错误:

ng2-gridstack error

这是我的app.module.ts:

import { NgModule }      from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule } from '@angular/forms';
import { HttpModule } from '@angular/http';

import { GridStackComponent, GridStackItemDirective } from 'ng2-gridstack';
import { AppComponent }  from './app.component';
import { UserComponent }  from './components/user.component';
import { AboutComponent }  from './components/about.component';
import { routing }  from './app.routing';

@NgModule({
  imports:      [ BrowserModule, FormsModule, HttpModule, routing ],
  declarations: [ AppComponent, UserComponent, AboutComponent, GridStackComponent, GridStackItemDirective ],
  bootstrap:    [ AppComponent ]
})
export class AppModule { }

这是我的system.config.js

packages: {
  app: {
    'ng2-gridstack': {
        main: './ng2-gridstack.js',
        defaultExtension: 'js'
    },
    main: './main.js',
    defaultExtension: 'js',      
  },
  rxjs: {
    defaultExtension: 'js'
  }
  ...

尝试缓存干净,更新到最新版本的角度,但没有任何改变 .

1 回答

  • 0

    我相信您需要将 jquerylodash 导入到您的应用程序中才能运行 ng2-gridstat . ng2 gridstat是根据您必须同时具备的文档 @angular/coregridstat.js 编译的,以便运行 gridstat.js found here . 这是一个正确导入的plunker plunkr

    注意:在我刚刚使用CDN导入的plunker中

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.16.2/lodash.js"></script>
    

    您可能必须转到jquery和lodash文档以了解如何在应用程序中正确导入它们 .

相关问题