【发布时间】:2018-12-19 11:53:06
【问题描述】:
我有一个商店类,它有一个属性:
@observable customObject: customObject[] = [];
如果我想获得这个 observable 的值,我会在同一个类中创建一个方法吗:
选项 1
getCustomObject(): Observable<CustomObject[]> {
return this.customObject;
}
// the observable I'm using would be imported from "rxjs" and not "mobx"
选项 2
getCustomObject() {
return this.customObject;
}
// How can I subscribe to this observable when the method doesn't return an observable?
【问题讨论】:
标签: angular typescript rxjs store mobx