NGXS - 错误:属性没有初始化器并且在构造函数中没有明确分配

import { Store } from '@ngxs/store';

@Component({ ... })
export class ZooComponent {
animals$: Observable<string[]>;

constructor(private store: Store) {
this.animals$ = this.store.select(state => state.zoo.animals);
}
}

我正在使用 ngxs/store 但是,我收到以下错误:

error TS2564: Property 'animals$' has no initializer and is not definitely assigned in the constructor.
wudan713 回答:NGXS - 错误:属性没有初始化器并且在构造函数中没有明确分配

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/1069.html

大家都在问