Currently, I am working with angular2 and TypeScript where I have defined a class.
export class Example{
//.../
const self: all = this;
functionToCall(){
//.. Do somerthing
}
mainFunctionCall(){
somepromise.then(x => self.functionToCall('url/'+ x.name ) )
}
}
However, I keep encountering an error stating that functionToCall is undefined.
As I am fairly new to TypeScript/Angular, I wonder if there are any specific rules causing this issue. What is the correct way to call a method within a class from another method?