Les Paul Les Paul - 3 years ago 218
TypeScript Question

Angular2 Typescript "= () =>"

Easy question for someone to answer, what happens in this typescript function?

getTweetCount = () => this.data.totalCount;

data.totalCount is of type number from a service.

Answer Source

getTweetCount = () => this.data.totalCount;

You are creating an arrow function that returns this.data.totalCount.


Arrow functions : https://basarat.gitbooks.io/typescript/content/docs/arrow-functions.html

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download