Closed demetriusnunes closed 10 years ago
It's not possible to use another keyword, this
is the only object that will persist class-wide in javascript (unless you want to create a global). See #16 for some ways to mitigate issues with the this
keyword in callbacks.
Let me know if I'm misunderstanding your issue.
I thought that maybe it would be possible to create a closed scope around the controller using a function closure and bind the controller object to a class-wide variable.
But I see that you primarily use CoffeeScript so that's probably not a priority right now. :)
I think using "this" to refer to the controller is a bad idea, as often you'll introduce buggy code within function callbacks refering to the wrong "this".
Maybe it would be better to have a built-in & safe alias for "this", such as "self", "_this", "ctrl", "me", "$", "$$", or something else.