rang icon indicating copy to clipboard operation
rang copied to clipboard

Class instance variables in $scope

Open thomasguillory opened this issue 10 years ago • 1 comments

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

thomasguillory avatar May 19 '14 11:05 thomasguillory

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 ?

ranska avatar Jun 08 '14 21:06 ranska