Today we ran into an unusual thing: if a getter defined in the
prototype, it is not working in angular. Is there anything special
about this kind of getters?
Here is a jsfiddle about it: http://jsfiddle.net/UrXxq/
It would be nice if we can define getters and setters in the prototype
with the other functions.
Thanks,
Andras
If I changed the call in your html to:
getter defined in the prototype: {{value2()}}
and the prototype:
ApplicationCtrl.prototype = {
value2: function() {
console.log('value2 called!')
return this._value
}
}
works OK. The prototype you had wasn't defining an actual method.
HTH.
The prototype I showed should define a getter method. It is working
fine in nodejs, and I'd like to know if there is any reason why they
are not working with angular.
Or maybe it is a but that it is working in node?
Andras
> --
> You received this message because you are subscribed to the Google Groups "AngularJS" group.
> To post to this group, send email to ang...@googlegroups.com.
> To unsubscribe from this group, send email to angular+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/angular?hl=en.
>
>
Scopes aren't really instances of the controller, it's an instance of
a class inside of angular with the controller mixed into it.
https://github.com/angular/angular.js/blob/master/src/Scope.js#L181