View Full Version : How to create application functions for app-wide use?

22 Jan 2012, 5:43 AM
I would like to create application wide functions so my controllers and views can use them. However, it is saying that my functions are undefined when I try to use them from other classes. This is what I am trying to do:

name: 'MyApp',
someFunction: function(data) {

Then in my controller I try to do this: MyApp.someFunction(data), but it gives me this error:
Uncaught TypeError: Cannot read property 'fn' of undefined

What am I doing wrong?

Digital God
22 Jan 2012, 11:39 PM
Instead of MyApp.SomeFunction() in controller use this.application.SomeFunction()