ranska / rang

rang give sexy KISS to your angular files
MIT License
15 stars 2 forks source link

Class instance variables in $scope #13

Open thomasguillory opened 10 years ago

thomasguillory commented 10 years ago

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...

ranska commented 10 years ago

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 ?