当前的行为是什么?
我正在尝试获取自定义类型的 observable
export interface ConfigurationState {
outlet_id: number;
api_key: string;
}
在我的组件中
@Component({
selector: 'retail-root',
templateUrl: './root.component.html',
styleUrls: ['./root.component.scss']
})
export class RootComponent implements OnInit {
public config$: Observable<ConfigurationState>;
constructor(private store: Store<fromRoot.State>) {
this.config$ = this.store.select(fromRoot.getConfigState);
this.config$.subscribe(data => console.log(data));
}
ngOnInit() {
console.log(this.config$);
this.store.dispatch(new configActions.GetConfig());
}
}
当我像下面这样使用时
{{ config$ | async }}
它给了我[object Object]
,但如果订阅,this.config$.subscribe(data => console.log(data));
我会在控制台中得到正确的对象。
任何人都可以帮忙吗?