I am using Rx with Angular2, and using the Subscribe method, the call backs of the method preserve context of the component (or class) that called it, without passing any reference to it. My question is how do they do that? What is the Javascript trick that makes it possible?
Code snippet:
this._userService.SignUpUser(this.model).subscribe(
user => {
this.newuser = user; // this, is actually same as the calling "this"? How does this work?
},
error => this.errorMessage = <any>error
);