I am building an ionic app and i keep getting this error and dont know why.
This is my code
app.js
var app = angular.module('loanstreet', ['ionic', 'ui.select', 'ion-autocomplete', 'loanstreet.controllers', 'ngCordova', 'loanstreet.services', 'ngMockE2E', 'loanstreet.constants', 'frapontillo.ex.filters'])
.config(function($stateProvider, $urlRouterProvider, $httpProvider) {
$stateProvider
.state('login', {
url: "/login",
templateUrl: "templates/login.html",
controller: 'AppCtrl'
})
});
js/controllers/controllers.js
var app = angular.module('loanstreet.controllers', []);
js/controllers/app_controller.js
angular.module('loanstreet.controllers')
.controller('AppCtrl', function($scope, $ionicModal, $timeout, $state, AuthenticationService, $location, $rootScope) {
})
index.html
<script src="js/app.js"></script>
<script src="js/controllers/controllers.js"></script>
<script src="js/controllers/app_controller.js"></script>
<body ng-app="loanstreet">
<ion-nav-view></ion-nav-view>
</body>
I am a bit confused as to why it doesnt recognize the AppCtrl even though i have already defined it in the code. I read it has to do with angular 1.3x but still cant figure it out.
Any help appreciated
You're trying to define new modules with
angular.module('loanstreet.controllers').controller
But without a second argument, angular.module gets (doesn't create) a module.
Try:
angular.module('loanstreet.controllers',[]).controller