I'm using this function to upload the file
async uploadFile(file)
{
let promise = new Promise((resolve, reject) => {
bucket.upload(params, function (err, data) {
this.file=`<a href='${this.FileName}' target=_blank'>File</a>`;
this.send();
resolve(this.FileName);
Calling this.send
but getting this error ERROR TypeError: Cannot read properties of undefined reading angular
at this.send()
line.
Any suggestion to resolve this issue.
CodePudding user response:
Use arrow function instead of function expression so that upload call back this
will point to parent scope.
bucket.upload(params, (err, data)=> {
.......
});