I'm currently experimenting with Browserify + Angular and I've stumbled into a weird issue. I've created a file within a subdir for my controller called controllers/start-controller.js.`
In my app.js file I have a local variable that references the controllers:
var controllers = require('./controllers/');
Within controllers/ is an index.js file that references the start-controller:
require('./start-controller');
And then back in my app.js, to call the controller I have the following:
app.controller('StartController', ['$scope', controllers.StartController]);
The problem:
With the current setup, StartController isn't recognised and Angular throws this error. However, if I change the local variable to include start-controller directly:
var controllers = require('./controllers/start-controller');
Then this works fine but this isn't really what I'm after. I'd like to be able to reference the controllers within controllers/index.js. Is app.controller missing something in the call to StartController which is why it can't recognise it?
controllers.StartControlleris undefined? Can you create a small example? I cannot reproduce any issues on my side.index.jswould be a lot more helpful.