Error when trying to add new Controllers and Modules using IIFE style


#1

Hi,
I am trying to add new modules and controllers using gulp-inject.
Problem is that I get an error when I adding new modules / controllers in IIFE:

ionic.bundle.js:13438 Uncaught Error: [$injector:nomod] Module ‘app.home’ is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.

// app.js

(function () {
  'use strict';
angular.module('app', ['ionic', 'app.home'])
.run(function($ionicPlatform) {....... }

// home.module.js

(function () {
‘use strict’;
angular.module(‘app.home’, []);
})();

// home.controller.js

(function () {
‘use strict’;
angular.module(‘app.home’)
.controller(‘HomeController’, HomeController);
function HomeController() {

})();

Only if I remove the IIFE from home.controller.js and declare the module in the controller file the error does not show.

angular.module('app.home', [])
    .controller('HomeController', HomeController);

Is this the only way of adding new modules to ionic app?

Thanks.