I've been working with requireJS in my application.
Every time I try to register a controller on my module, it gives me an error saying that the controller is not defined. Here's the code for my LoginController located in login.controller.js:
function LoginController() {
}
Below is my module code:
require('angular')
require('@uirouter/angularjs');
require('./service/storage')
require('./controller/login.controller')
angular.module('SecurityModule', ['ui.router'])
.controller('LoginController', LoginController);
// Routing
angular.module('SecurityModule')
.config(function ($stateProvider, $urlRouterProvider, $locationProvider) {
$locationProvider.hashPrefix('');
$stateProvider.state('login', {
url: '/login',
templateUrl: '/app/resources/view/security/login.html',
controller: 'LoginController',
});
})
;
Even though I checked my bundled.js file and saw that the declaration of LoginController appears first, it still shows as undefined. Any idea why?
Appreciate any help!
Also, just a heads up - I'm using browserify (which utilizes commonJS) for bundling my files.