Got:
http.request('js/app/config/config.json').subscribe(data => {
this.url = data.json().url;
});
and somehow "this" points to Subscriber. Don't know why... cause I thought that fat-arrow lambda will catch parent's class pointer.
Why so?
Based on the screenshot : http://d.pr/i/iBa
You are debugging this
in the console. Please note that this
on the console will be the actual this. When TypeScript generates an arrow function for non ES6 JavaScript (which doesn't have native support for arrow functions) this
is mapped to _this
(and other things) which means that you need to view _this
.
Just debug the generated JavaScript when learning TypeScript. This is the TypeScript bug : https://github.com/Microsoft/TypeScript/issues/2859 if you are interested.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With