이온 검색 창에서 동적 검색을 수행하기 위해 FirebaseListObservable을 쿼리하는 이온 페이지가 있습니다. [email protected]과 [email protected]에서 잘 작동합니다. 새 릴리스를 업그레이드 한 후 AngularFire 5.0 FirabaseListObservable에 대한 문제가 발생하여 새 Api에서 내 보내지 않았습니다. AngularFireList를 'Observable 유형에 할당 할 수 없습니다. <Response>
import { Component } from '@angular/core';
import { IonicPage, NavParams, ViewController } from 'ionic-angular';
import {AngularFireDatabase, FirebaseListObservable} from 'angularfire2/database';
import { Observable} from 'rxjs';
import { Response } from '@angular/http';
@IonicPage()
@Component({
selector: 'page-modal-groups',
templateUrl: 'modal-groups.html'
})
export class ModalGroupsPage {
groups: FirebaseListObservable<any>;
constructor(public navParams: NavParams,
public viewCtrl:ViewController,
public afDatabase: AngularFireDatabase) {
}
getItems = (ev: any) : Observable<Response> => {
this.groups = this.afDatabase.list('/Groups', {
query:{
orderByChild: 'namelower',
startAt: (ev.target.value),
endAt: (ev.target.value + '\uf8ff')
}
}
);
return this.groups;
}
chooseGroups(item:any){
this.viewCtrl.dismiss(item);
// console.log(this.product);
}
closeModal(){
this.viewCtrl.dismiss();
}
}
<ion-header>
<ion-navbar>
<ion-title>Grup Seç</ion-title>
<ion-buttons end>
<button ion-button color="danger" (click)="closeModal()" >
Kapat
</button>
</ion-buttons>
</ion-navbar>
</ion-header>
<ion-content padding>
<ion-searchbar (ionInput)="getItems($event)"></ion-searchbar>
<ion-list>
<ion-item *ngFor="let item of groups | async" (click)="chooseGroups(item)">
{{ item.name }}
</ion-item>
</ion-list>
<!--<button ion-item *ngFor="let item of products | async" (click)="chooseProduct(item)">
{{item.name}}
</button>-->
</ion-content>
** 메시지 : '유형'Observable []> '을'관찰 가능 '유형에 할당 할 수 없습니다. 유형 'AngularFireAction []'을 '응답'유형에 지정할 수 없습니다. 유형 'AngularFireAction []'에 'type'속성이 없습니다. ' 는
import { Component } from '@angular/core';
import { IonicPage, NavParams, ViewController } from 'ionic-angular';
import {AngularFireDatabase, AngularFireAction} from 'angularfire2/database';
import { Observable, BehaviorSubject} from 'rxjs';
import { Response } from '@angular/http';
/**
* Generated class for the ModalGroupsPage page.
*
* See http://ionicframework.com/docs/components/#navigation for more info
* on Ionic pages and navigation.
*/
@IonicPage()
@Component({
selector: 'page-modal-groups',
templateUrl: 'modal-groups.html',
})
export class ModalGroupsPage {
items: Observable<AngularFireAction<firebase.database.DataSnapshot>[]>;
group: BehaviorSubject<any>;
constructor(public navParams: NavParams,
public viewCtrl:ViewController,
public afDatabase: AngularFireDatabase) {
}
getItems = (ev: any) : Observable<Response> => {
this.group = new BehaviorSubject(ev);
this.items = this.group.switchMap(name =>
this.afDatabase.list('/Groups', ref => name ? ref.orderByChild('namelower').startAt(ev.target.value).endAt(ev.target.value + '\uf8ff') : ref
).snapshotChanges());
return this.items;
}
.valueChanges()
를 사용할 필요가
젠장 아래를 참조로 AngularFireAction를 사용할 필요가 ninja'd .. : P –
Hehe'1 분'지연 : D @SurajRao – Sampath
틀린 것이 아니라면 'this.groups'의 선언 유형을 변경해야 할 수도 있습니다. –