这是我的代码
class MyClass {
private ref: any;
private ourprogress: any = 0;
onUploadAll() {
ref.api(somedata).then(function (snapshot) {
this.ourprogress++;//Not working
});
}
}
无论什么,我们的进步都保持不变
答案 0 :(得分:0)
这有效:
class MyClass {
private ref: any;
private ourprogress: any = 0;
onUploadAll() {
ref.api(somedata).then((function (snapshot) {
this.ourprogress++;//Now works
}).bind(this));
}
}