In index.html, I have added path to controller file.
I am getting this error with controller. Even if I comment out the code in controller.js, I still get this error.
controller.js
angular.module('starter.controllers', [])
.controller('AppCtrl', function($scope,$state,$stateParams,$rootScope){
});
app.js
// Ionic Starter App
// angular.module is a global place for creating, registering and retrieving Angular modules
// 'starter' is the name of this angular module example (also set in a <body> attribute in index.html)
// the 2nd parameter is an array of 'requires'
angular.module('starter', ['ionic', 'starter.controllers'])
.run(function($ionicPlatform) {
$ionicPlatform.ready(function() {
// Hide the accessory bar by default (remove this to show the accessory bar above the keyboard
// for form inputs)
if(window.cordova && window.cordova.plugins.Keyboard) {
cordova.plugins.Keyboard.hideKeyboardAccessoryBar(true);
}
if(window.StatusBar) {
StatusBar.styleDefault();
}
});
})
.config(function($stateProvider, $urlRouterProvider) {
$stateProvider
.state('navBar', {
url: "/navBar",
abstract: true,
templateUrl: "templates/navigationBar.html",
controller:'AppCtrl'
})
.state('navBar.orderReceive', {
url: "/orderReceive",
views: {
'orderReceiveView': {
templateUrl: "templates/OrderReceiveChoice.html"
}
}
})
$urlRouterProvider.otherwise(function ($injector) {
var $state = $injector.get('$state');
$state.go('navBar.orderReceive');
});
})
But I get an error
Error:
TypeError: Cannot read property 'controller' of undefined
at IonicModule.controller.self.update (ionic.bundle.js:51695)
at IonicModule.controller.self.beforeEnter (ionic.bundle.js:52135)
at IonicModule.controller.self.beforeEnter (ionic.bundle.js:54079)
at Scope.$get.Scope.$emit (ionic.bundle.js:24919)
at Object.IonicModule.factory.ionicViewSwitcher.create.switcher.emit (ionic.bundle.js:50634)
at Object.IonicModule.factory.ionicViewSwitcher.create.switcher.transition (ionic.bundle.js:50492)
at ionic.bundle.js:52121
at ionic.bundle.js:50370
at Object.IonicModule.factory.ionicViewSwitcher.create.switcher.render (ionic.bundle.js:50459)
at Object.IonicModule.factory.ionicViewSwitcher.create.switcher.init (ionic.bundle.js:50369)(anonymous function) @ ionic.bundle.js:21157$get @ ionic.bundle.js:17936$get.Scope.$emit @ ionic.bundle.js:24921IonicModule.factory.ionicViewSwitcher.create.switcher.emit @ ionic.bundle.js:50634IonicModule.factory.ionicViewSwitcher.create.switcher.transition @ ionic.bundle.js:50492(anonymous function) @ ionic.bundle.js:52121(anonymous function) @ ionic.bundle.js:50370IonicModule.factory.ionicViewSwitcher.create.switcher.render @ ionic.bundle.js:50459IonicModule.factory.ionicViewSwitcher.create.switcher.init @ ionic.bundle.js:50369IonicModule.controller.self.render @ ionic.bundle.js:52115IonicModule.controller.self.register @ ionic.bundle.js:52073updateView @ ionic.bundle.js:57485IonicModule.directive.compile @ ionic.bundle.js:57469invokeLinkFn @ ionic.bundle.js:17477nodeLinkFn @ ionic.bundle.js:16977compositeLinkFn @ ionic.bundle.js:16368nodeLinkFn @ ionic.bundle.js:16972compositeLinkFn @ ionic.bundle.js:16368nodeLinkFn @ ionic.bundle.js:16972compositeLinkFn @ ionic.bundle.js:16368nodeLinkFn @ ionic.bundle.js:16972compositeLinkFn @ ionic.bundle.js:16368publicLinkFn @ ionic.bundle.js:16243IonicModule.controller.self.appendViewElement @ ionic.bundle.js:52259IonicModule.factory.ionicViewSwitcher.create.switcher.render @ ionic.bundle.js:50449IonicModule.factory.ionicViewSwitcher.create.switcher.init @ ionic.bundle.js:50369IonicModule.controller.self.render @ ionic.bundle.js:52115IonicModule.controller.self.register @ ionic.bundle.js:52073updateView @ ionic.bundle.js:57485(anonymous function) @ ionic.bundle.js:57462$get.Scope.$broadcast @ ionic.bundle.js:24992$state.transitionTo.$state.transition.resolved.then.$state.transition @ ionic.bundle.js:44836processQueue @ ionic.bundle.js:23394(anonymous function) @ ionic.bundle.js:23410$get.Scope.$eval @ ionic.bundle.js:24673$get.Scope.$digest @ ionic.bundle.js:24484$get.Scope.$apply @ ionic.bundle.js:24778done @ ionic.bundle.js:19191completeRequest @ ionic.bundle.js:19363requestLoaded @ ionic.bundle.js:19304