4

私はもう試した:

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);

しかし、その後 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);
  }
}

しかし、私は得るCannot resolve all parameters for MyAppComponent。誰でもこれで私を助けることができますか? immutableはい、フォルダを に追加しましたSystem.paths。Immutable は ES6 のような方法でインポートできないのでしょうか?

4

1 に答える 1

5

ちょっとしたミスでした。私は変わらなければならなかった

import {Immutable} from 'immutable/immutable';

import Immutable from 'immutable/immutable';
于 2015-04-09T00:39:11.600 に答える