You can reorganize something like this:
class DetailDriver {
public get driver() {
return super.getEntity();
}
public activate(): breeze.Promise {
var id = this.driver.id();
return promise
.then(this.getCertificate.bind(this))
.fail(somethingWrong);
}
private getCertificate() {
var id = this.driver.id();
return ...
}
}
Using a keyword functionanywhere in your class will make the keyword thislink a link to this function, not an external class. Typically, you want to avoid defining functions inside classes unless you use the thick arrow syntax. It will look like this:
class DetailDriver {
public get driver() {
return super.getEntity();
}
public activate(): breeze.Promise {
var id = this.driver.id();
return promise
.then(() => {
var id = this.driver.id();
return ...
})
.fail(somethingWrong);
}
}
source
share