Can someone help clarify the use of arrow functions in TypeScript with an example from Angular 2's Observable subscribe method? Here's my question:
I have code that is functional:
this.readdataservice.getPost().subscribe(
posts => { this.posts = posts; }
);
But would it work the same way if I try using this approach? It doesn't seem to work.
this.readdataservice.getPost().subscribe(
function (posts) {
this.posts = posts;
}
);