One App Controller vs. Multiple Controllers


I am a newbie in all things Ionic/AngularJS, but am hopefully learning quickly. In the Side-Bar template, it has a main controller app and has embedded controllers. My friend’s app has individual controllers and no top level controller. Which is better? Why would there be differences?

Thank you for your help!

Best wishes,

I prefer one global and page specific controllers
that way dont need to worry about $scope variable conflicting, and if you want to access functions globally put them in the global controller.

and multiple you can use $scope.$on('$ionicView.enter', function(){}); for only that page if needed

1 Like

This is very helpful. Thank you for explaining the “why” behind the decision as well, Chaos!