0

AngularFire2 주문이 작동하지 않습니다.query anglefire2에서 작동하지 않습니다.

'주문'을 업데이트하는 버튼이 있습니다. 스위치 케이스의 올바른 경우가 트리거되지만 결과는 초기 주문과 동일합니다.

@Component({ 
    selector: 'app-compact-research-report-list', 
    template: ` 
    <loader *ngIf="!(allRRs$ | async)" [loading]=true [message]="'loading view...'"></loader> 
    <ul class="list-unstyled clearfix"> 
     <li class="youtube-list-item" [@fadeIn] *ngFor="let rr of (allRRs$ | async)"> 
     <app-compact-research-report [media]="rr"></app-compact-research-report> 
     </li> 
    </ul> 
    `, 
    changeDetection: ChangeDetectionStrategy.OnPush 
}) 
export class CompactResearchReportListComponent implements OnInit { 
     public allRRs$: Observable<ResearchReport[]>; 
     ngOnInit() { 
     this.authService.reportDDBS$.subscribe((order) => { 
      console.log('Reportorder = ' + order); 
      switch (order) { 
      case 'uploadDate': 
       this.allRRs$ = this.dalService.this.afDb.list(`research_reports-published/`, ref => ref.orderByChild('uploadDate')).valueChanges(); 
       break; 
      case 'filename': 
       this.allRRs$ = this.dalService.this.afDb.list(`research_reports-published/`, ref => ref.orderByChild('filename').valueChanges(); 
       break; 
      case 'uploaderName': 
       this.allRRs$ = this.dalService.this.afDb.list(`research_reports-published/`, ref => ref.orderByChild('uploaderName').valueChanges(); 
       break; 
      case 'revDownloads': 
       this.allRRs$ = this.dalService.this.afDb.list(`research_reports-published/`, ref => ref.orderByChild('revDownloads').valueChanges(); 
       break; 
      default: 
       this.allRRs$ = this.dalService.this.afDb.list(`research_reports-published/`, ref => ref.orderByChild('uploadDate').valueChanges(); 
      } 
     }); 
     } 
} 

답변

0

문제는 Firebase에서 발견되지 않았습니다. ChangeDetectionStrategy.OnPush에서 ChangeDetectionStrategy.Default으로 변경하면 문제가 해결됩니다.