Quantcast
Channel: Should I write methods as arrow functions in Angular's class - Stack Overflow
Browsing all 4 articles
Browse latest View live

Answer by Estus Flask for Should I write methods as arrow functions in...

The points made in this React answer are still valid in Angular, any other framework or vanilla JavaScript/TypeScript.Class prototype methods are ES6, class arrow methods aren't. Arrow methods belong...

View Article



Answer by Andrei Matracaru for Should I write methods as arrow functions in...

There's just one case where you have to refrain from using arrow functions if you need to do AOT compilation, as documented hereWhen configuring a module, you can't use arrow functions.❌ DONT:import {...

View Article

Answer by Milad for Should I write methods as arrow functions in Angular's class

A good use case of class arrow functions are when you want to pass a function to another component and save the context of current component in the function.@Component({ template:` I'm the...

View Article

Should I write methods as arrow functions in Angular's class

In Angular it's technically possible to write class methods as ES2015 arrow functions, but I have never actually seen someone do it. Take this simple component for instance:@Component({ selector:...

View Article
Browsing all 4 articles
Browse latest View live




Latest Images