AmitXShukla / Online-Shop-eCommerce-App-Angular-6-Firebase

Online eCommerce Store app in Angular 11.0 & Firebase
MIT License
100 stars 80 forks source link

Please give me more instructions #9

Closed hoangha090399 closed 4 years ago

hoangha090399 commented 4 years ago

Hello sir, I want to ask about the getFilterProducts section. I did the getFilterProducts part by myself But it didn't work. Hope you can help me. I am a student and my level is still weak. If it wrong,so you can ignore for me. I was tried Thanks (version in youtube) this is setproduct.ts page 1 this is service.ts page 2

I tried the same way in the github file but error at "...data" 3

AmitXShukla commented 4 years ago

I will sure help you, in your last screen shot, a pop-up describe hide snapshotchange().map.... So, I am not able to see full method implementation can you please show me that code as well. image

hoangha090399 commented 4 years ago

Thanks for the reply. 4 and this is product.ts ( it is setproduct.ts in your video in youtube ) 5

AmitXShukla commented 4 years ago

I look at original code and see this method doesn't look like yours at all. I've commented everything after valuechanges();

Line #163 https://github.com/AmitXShukla/Online-Shop-eCommerce-App-Angular-6-Firebase/blob/master/src/app/services/firebase.service.ts

getFilterProducts(coll: string, filters) {
    return this.afs.collection(this.getCollectionURL(coll), ref =>
    ref.where('delete_flag', '==', 'N')
        .where('tags' , 'array-contains', filters)
        .orderBy('tags', 'desc')
).valueChanges();
    // .snapshotChanges()
    // .map(actions => {
    //     return actions.map(a => {
    //         const data = a.payload.doc.data();
    //         const id = a.payload.doc.id;
    //         return { id, ...data };
    //     });
    // });
hoangha090399 commented 4 years ago

I have understood the problem.

Thank you very much for answering and supporting me.