Baobabは、Angular 2を使ってFluxアプリケーションを構築する興味深い方法のようですが、例は見つかりませんでした。Anger2を使ってangular2コンポーネントを更新するには
@Component
({ selector: 'foo'
, template:
` <ul>
<li *ngFor='#color of (colors | async)'>
{{ color }}
</li>
</ul>
`
}
)
export default class FooComponent {
colorsCursor: any
constructor (@Inject (storeToken) private store) {
// https://github.com/Yomguithereal/baobab
this.colorsCursor = store.select('palette', 'colors')
this.colorsCursor.on
('update'
,() => {
// What do I put here to update the component ?
}
)
}
get colors() {
return this.colorsCursor.get()
}
}
をまたは私はコンポーネントに入力を介してデータをプッシュする必要があります。
私の主な質問は、私はバオバブに角度成分「を購読」どうすればよいのですか?しかし、私はどのようにこのすべてを配線するかわかりません...