I have the following code for the ionic app that I am building. Currently I have all the code below in a single js file. I want to separate out the controller code into each individual js file and somehow am not able to get this to work.
I have tried out the solution mentioned @ How can I have one file per controller?
However this did not work for me. Could you’ll please help me with this one?
You are right to want to split your controllers and features up into separate JS files etc. This example will hopefully make sense. I have my top level app module (app.js), and it requires my demo.features.controllers module (features.mod.js).
demo.features.controllers contains both my controllers.
From this simple example you should be able to see that the benefits of the modularity of AngularJS.
@gnomeontherun I have tried this and somehow it doesn’t work out for me. That is why I posted a query here. Apart from seperating out the module controller into separate files, I have referenced each JS file (seperate controllers) in the head section of the HTML. Is that right?
@gnomeontherun I implemented what you have suggested and it worked! I had tried the same thing before and it hadn’t worked. Wondering what mistake had I done! But well, your solution worked…