无法将列表模块从immutable.js导入Angular 2项目

时间:2016-12-27 09:34:36

标签: javascript angular typescript immutable.js

我正在尝试在新的Angular 2项目中使用immutable.js中的npm install模块。当我这样做时,浏览器会尝试获取http://localhost:3000/immutable并因404 Not Found错误而失败。

这是我做的:

  • 我克隆了Angular 2快速入门 来自Github的回购(https://github.com/angular/quickstart
  • 我跑了npm install -D immutableimport { NgModule } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { AppComponent } from './app.component'; import { List } from 'immutable'; @NgModule({ imports: [ BrowserModule ], declarations: [ AppComponent ], bootstrap: [ AppComponent ] }) export class AppModule { constructor() { let list = List.of(1,2,3); } }

然后我修改了app.module.ts,如下所示:

npm start

当我declare @temp table(empid int,fh int,fb int, fhra int) insert into @temp SELECT * FROM ( SELECT empid,fieldname as [field],value as val FROM dbo.emp ) as s PIVOT ( min( val) FOR [field] IN (fh,fb,fhra) )AS pvt select * from @temp join table1 项目时,我收到404错误。

我错过了一些明显的东西吗?

1 个答案:

答案 0 :(得分:1)

经过更多的谷歌搜索,我发现答案很简单。我只需要在systemjs.config.js中向地图添加一个新元素:

// other libraries
[...]
'immutable': 'node_modules/immutable/dist/immutable.js'