Edit in angular 4

笑着哭i 提交于 2019-12-13 03:03:38

问题


I am working on Angular 4 project. Here I want to update the form data using firebase key

I have pass the data through component.ts as follow

    this.service.editEnquiry(this.data);

I called editEnquiry() of service. the editEnquiry() is given as follows

editEnquiry(data)
{

    console.log(data);
    console.log(data.key);    
     this.af.list(`/enquirydata/`+key).update(data);
}

I am getting the data in editEnquiry() but its not updating the record in firebase. Its giving me error like this

Supplied parameters do not match any signature of call target.

any help?


回答1:


If you updating the data then you need to use -

AngularFireDatabase.object

please try below solution hope it helps -

editEnquiry(data)
{

    console.log(data);
    console.log(data.key);    
    this.af.object(`/enquirydata/`+key).update(data);
}



回答2:


we have to pass the key and the edited data and the edited function should be like this

 editEnquiry(key,value)
{

    console.log(key);
    console.log(value);
this.af.object(`/enquirydata/`+ key).update(value);
}

It worked for me



来源:https://stackoverflow.com/questions/48942577/edit-in-angular-4

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!