Menu icon Foundation
Foundation [$injector:nomod] Module 'application' is not available

Hello Everybody,

I got always this error if I want to create a controller in a separate file for example in HomeController.js Does anyone know the reason for this?

1. HomeController.js (doesn't work)
2. Included in app.js (working)

(function () {
  'use strict';
  angular.module('application').controller('HomeController', HomeController);

  HomeController.$inject = ['$scope', '$stateParams', '$state', '$controller'];

  function HomeController($scope, $stateParams, $state, $controller) {
    angular.extend(this, $controller('DefaultController', {
      $scope: $scope,
      $stateParams: $stateParams,
      $state: $state
    }));
    $scope.test = "test1";

  }
})();


            

         

angular.module('application', [
      'ui.router',
      'ngAnimate',

      //foundation
      'foundation',
      'foundation.dynamicRouting',
      'foundation.dynamicRouting.animations',
      'HomeController'
    ])
    .controller('HomeController', function ($scope, $state, $stateParams, $controller, $http) {
      console.log('HomeControler')'
      };
            

            

         

foundation for apps

Hello Everybody,

I got always this error if I want to create a controller in a separate file for example in HomeController.js Does anyone know the reason for this?

1. HomeController.js (doesn't work)
2. Included in app.js (working)

(function () {
  'use strict';
  angular.module('application').controller('HomeController', HomeController);

  HomeController.$inject = ['$scope', '$stateParams', '$state', '$controller'];

  function HomeController($scope, $stateParams, $state, $controller) {
    angular.extend(this, $controller('DefaultController', {
      $scope: $scope,
      $stateParams: $stateParams,
      $state: $state
    }));
    $scope.test = "test1";

  }
})();


            

         

angular.module('application', [
      'ui.router',
      'ngAnimate',

      //foundation
      'foundation',
      'foundation.dynamicRouting',
      'foundation.dynamicRouting.animations',
      'HomeController'
    ])
    .controller('HomeController', function ($scope, $state, $stateParams, $controller, $http) {
      console.log('HomeControler')'
      };
            

            

         
Rafi Benkual almost 4 years ago