2017-04-07 5 views
0

私は、データベース状態の更新を待機するリアクティブポーラーに接続された多次元配列を持っています。状態1xをロードすると、uiは期待どおりに動作します。Angular2 Pollerリセットng-bootstrap accordin

問題:ポーラーをオンにすると、アコーディオン状態が閉じます。

コード:

<ngb-accordion #acc="ngbAccordion" [closeOthers]="true"> 
    <ngb-panel *ngFor="let group of fishGroups | async" title="{{group[0].source.originalname}}"> 
     <template ngbPanelContent> 
      ...... 
     </template> 
    </ngb-panel> 
</ngb-accordion> 


ngOnInit() { 
    console.log('ngOnInit'); 

    this.fishGroups = this.fisheService.elements 
    //ensure not null 
    .filter((arr: DTOfish[]) => (arr != null && arr.length > 0)) 
    // create milti dimensional array 

    .map((fishes : DTOfish[]) => { 
     let groups: DTOfish[][] = []; 
     fishes.forEach((fish: DTOfish) => { 
     //note double assignment : if null create 
     let group: DTOfish[] = groups[fish.source.id] = groups[fish.source.id] ? groups[fish.source.id] : []; 
     group.push(fish); 
     }); 

     //make sparse array dense 
     return groups.filter(value => !!value); 
    }); 

    this.fishes = this.fisheService.elements.map((fishes: DTOfish[]) => { 
    return fishes.filter((fish: DTOfish) => !fish.model.isFailed) 
    }); 


    this.fisheService.loadAll(); 

    this._interval = global.setInterval(() => { 
    console.log('fishComponent Poller'); 
    this.fisheService.loadAll(); 
    }, 2000); 

} 

質問: はどのように私はポーラーは更新状態を返したときに、選択したコンテンツパネルが開いたままですか?

答えて

関連する問題