抱歉,我不太理解ngoninit中代码的目标。
调用选择器应返回Observable。
然后你只需要通过管道把可观测数据传递给你的组件。
所以请你试试这个,如果它能帮到你的话。以下是它可以是什么(遵循您的代码):
//parentcomponent.html
<mat-card style="margin: 1px;">
<search-form [messageTypeList]="messageTypeList$ | async" [rowData]="rowData | async">
</search-form>
</mat-card>
父组件ts文件
//parentcomponent.ts
messageTypeList$: Observable<Messagetype[]>;
ngOnInit() {
this.messageTypeList$ = this.store.select(fromStore.getMessageTypeListData);
// only if you need to load data into store before...
this.store.dispatch(new fromStore.LoadMessageType({}));
})
子组件
//childcomponent.ts
@Input() messageTypeList: Messagetype[];
ngOnInit() {
console.log('messagetypelist=', this.messageTypeList);
}