2017-08-21 6 views
0

education_qualificationオブジェクトの内部にランダムキーが生成されました。 私はそのキーを更新しようとしましたが、内部のキーではなく、education_qualificationしか持っていません。私はangle2でオブジェクトの子キーを取得したい

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/'); 
     for (let i = 0; i <= education.length; i++) { 
      edu.push(education[i]); 
      edu.update({ 
        id: edu.key, 
      }); 
     } 
    }); 
} 

I want key inside of education_qualification

+0

私はuが言いたいのか理解できないのですか? – Krunal

+0

はいオブジェクトをプッシュした後にキーのみを更新したい – Krunal

+0

写真を参照education_qualificationの中にキーを取得したい – Krunal

答えて

-1

プッシュデータベース参照を返します。

Firebase push documentation

これは、次のあなたがキーを取得することを意味する:

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/'); 
     for (let i = 0; i <= education.length; i++) { 
      edu.push(education[i]); 
      edu.update({ 
        id: edu.key, 
      }); 
     } 
    }); 
} 
関連する問題