如何将不可变的js导入angular 2(alpha)
How do I import immutable js into angular 2 (alpha)?
我尝试过:
import {Component, Template, bootstrap} from 'angular2/angular2';
import {Immutable} from 'immutable/immutable';
@Component({
selector: 'my-app'
})
@Template({
inline: '<h1>Hello {{ name }}</h1>'
})
class MyAppComponent {
constructor() {
this.name = 'Alice';
this.wishes = Immutable.List(['a dog', 'a balloon', 'and so much more']);
console.log(this.wishes);
}
}
bootstrap(MyAppComponent);
但随后"不可更改"最终被定义。然后我尝试了:
import {Component, Template, bootstrap} from 'angular2/angular2';
import {Immutable} from 'immutable/immutable';
@Component({
selector: 'my-app'
})
@Template({
inline: '<h1>Hello {{ name }}</h1>'
})
class MyAppComponent {
constructor(im: Immutable) {
this.name = 'Alice';
this.wishes = im.List(['a dog', 'a balloon', 'and so much more']);
console.log(this.wishes);
}
}
但后来我得到了Cannot resolve all parameters for MyAppComponent
。有人能帮我吗?是的,我已经将immutable
文件夹添加到了System.paths
中。难道Immutable就是不能以ES6的方式导入吗?
import {Immutable} from 'immutable/immutable';
至
import Immutable from 'immutable/immutable';
相关文章:
- Angular JS IE9 Hashbang url rewriting
- 如何使用skip参数使用angular ui引导进行服务器端分页
- 在自定义mean.io包中使用angular-chart.js作为依赖项
- 无法在数据endVal中设置值=“”;{{ucount}}”;使用Angular JS的CountUp
- 使用angular重定向到html页面
- angular.js没有'无法在PhoneGap中处理视图标记
- Javascript(Angular)从一个对象数组到第二个数组查找值
- angular 1.5应用程序中的导航栏
- angular的下拉菜单
- Angular只从数组中获取所需的数据
- 如何将不可变的js导入angular 2(alpha)
- Angular js-返回一个包含类似
- 如何使用 Angular JS 将数据保存在数据库中
- 将JSON对象传递给angular指令
- 从HTTPGET返回一个自定义对象列表,以便在Angular 2应用程序中使用
- Angular:更新一次性绑定的数据
- 同步调用,直到用户通过angular验证为访问者
- 将Angular js与taglib结合使用
- Angular2材质设计alpha.9-3有'404 not found'@angular /材料
- Angular 2 alpha 22,如何通过属性将值传递给组件