rang
rang copied to clipboard
Class instance variables in $scope
In ScopeCtrl
, it would be awesome to automatically have access to all instances variables in $scope, as for methods :
Controller:
class MyCtrl extends ScopeCtrl
initialize: ->
@counter = 0
incrementCounter: =>
++@counter
decrementCounter: =>
--@counter
View:
{{ counter }}
<button ng-click="incrementCounter()">
<button ng-click="decrementCounter()">
Main issue : I can't see how to nicely implement it. It would certainly need to implement a double data binding between $scope
and controller object, which can done with watchers, but at a cost...
It's interesting. So we need to keep the fact that
@_private_methode
is not on the scope.
And why a fat arrow ? we should try to keep simple arrow ?