i like new arrow ()=>{}
syntax and i would like to use it everywhere it's possible. I know that arrow function points to outer this contex. Is there is a way to use arrow function just like normal function? I only need to make this
points to the inner of the arrow function.
I need to make this code:
let foo = () => {
// "this" keyword should point to the inner of that function, not window object
}
works like this code:
function foo() {
// "this" keyword points to the inner of that class/object/function/whatever-it-calls-fix-me-if-am-i-wrong
}
Is it achievable or i need to stick to the function
keyword?
To be more specific i need the this
thing to make it working with controllerAs syntax in Angular, but that's not the point. It's rather JS question than AngularJS question.