angular - I want to get child key of object in angular2 -
inside of education_qualification object random key generated want key, how possible ? have tried update key got education_qualification not inside key.
create(model, bankdetails, currentaddress, permanentaddress, education) { const obj = this.employees.push(model); obj.update({ id: obj.key, bank_details: bankdetails, current_address: currentaddress, permanent_address: permanentaddress, }, (error) => { const edu = obj.child('/education_qualification/'); (let = 0; <= education.length; i++) { edu.push(education[i]); edu.update({ id: edu.key, }); } }); }
push returns database reference.
this means key following:
create(model, bankdetails, currentaddress, permanentaddress, education) { const obj = this.employees.push(model); obj.update({ id: obj.getkey(), bank_details: bankdetails, current_address: currentaddress, permanent_address: permanentaddress, }, (error) => { const edu = obj.child('/education_qualification/'); (let = 0; <= education.length; i++) { edu.push(education[i]); edu.update({ id: edu.key, }); } }); }
Comments
Post a Comment