Eve*_*ert 4 javascript ecmascript-6 immutable.js angular
我试过了:
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);
Run Code Online (Sandbox Code Playgroud)
但是然后Immutable最终被定义为未定义.然后我尝试了:
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);
}
}
Run Code Online (Sandbox Code Playgroud)
但后来我明白了Cannot resolve all parameters for MyAppComponent.任何人都可以帮我吗?是的,我已经添加了immutable文件夹System.paths.可能是不可变的,不能以ES6的方式导入吗?
该死的,这是一个愚蠢的错误.我不得不改变
import {Immutable} from 'immutable/immutable';
Run Code Online (Sandbox Code Playgroud)
至
import Immutable from 'immutable/immutable';
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2897 次 |
| 最近记录: |