This doesn't answer your question - but you need to do some research on object oriented javascript and scope. Try googling the "javascript module pattern".
Also, you should commit this to memory: "The scope ('this') of a function is the object on which the function is defined". Once that makes sense to you, you will never have problems with scope again.
So in your example above your helper function is defined on the "helper" object. So read the comments below:
- scope: {
- count: 1
- },
- helper: {
- count: function(){
- // "this" refers to the helper object
- // "this.count" refers to the function we are currently inside
- // the following code is invalid because "this.count" is a function, not an integer
- return this.count + 1
- }
- }