Answer the question
In order to leave comments, you need to log in
Filtering out data on page load using angular4 + firebase?
Good afternoon, the task is such that in different columns it is necessary to display different data from firebase depending on their 'size' database
structure
items
-KhDCDkRWYO7Kwgo85XI
size: "small"
text: "First text"
-KhDCG6i4eS8VrUrgu4Z
size: "medium"
text: "Second text"
html file
ul
li class="text" *ngFor="let item of items | async"
{{item.text}}
/li
/ul
and items component
: FirebaseListObservable;
item: FirebaseObjectObservable;
sizeSubject: Subject;
constructor(private http: TransferHttp, af: AngularFire) {
this.sizeSubject = new Subject();
this.items = af.database.list('/items', {
// query: {
// orderByChild: 'size',
// equalTo: this.sizeSubject
// }
});
}
filterBy(size: string) {
this.sizeSubject.next(size);
}
How can I display in ngFor all elements with 'size' = 'small' for example. The commented lines help organize the filter when clicked, but initially then it does not display anything
Thank you very much in advance
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question