Ng2-Redux不在视图中显示对象属性

时间:2017-11-09 15:29:21

标签: angular redux

我的公司对象在我的视图中没有显示任何值。当我将subscribe方法附加到实例时,一切都正确显示在控制台中。

查看:

<h2>{{scopedCompany$.name | async}}</h2>
<h2 *ngFor="let company of companies$ | async">{{company.name}}</h2>

组件:

@select('scopedCompany') scopedCompany$: Observable<Company>;
@select('companies') companies$: Observable<Company[]>;

constructor(
    private securityService: OidcSecurityService,
    private ngRedux: NgRedux<IAppState>,
    private navigation: NavigationService
) { }

ngOnInit() {
  this.scopedCompany$.subscribe(x => console.log(x));
}

应用模块:

export class AppModule {
  constructor(ngRedux: NgRedux<IAppState>) {
    ngRedux.provideStore(store);
  }
}


 export interface IAppState {
    companies: Company[];
    scopedCompany: Company;
 }

公司数组显示name属性,但scopedCompany不显示。

0 个答案:

没有答案