Q:

How do I refactor my controllers.js so I have each controller in a separate file?

I am building an app using Ionic Framework and AngularJS 1x.
My system info:
Your system information:

Cordova CLI: 6.3.1
Gulp version:  CLI version 3.9.1
Gulp local:   Local version 3.9.1
Ionic Framework Version: 1.2.4
Ionic CLI Version: 2.1.0
Ionic App Lib Version: 2.1.0-beta.1
OS: Distributor ID: LinuxMint Description:  Linux Mint 18 Sarah 
Node Version: v4.2.6

I have a controllers.js file with all my controllers. however my app has become complex and the controllers.js file is now ~900 lines. I want to separate the controllers into their own files eg firstCtrl.js secondCtrl.js etc. I have googled for a while now but can't find anything. The only refactoring examples I could find are where the tutorial has everything in app.js and they refactor to controllers.js
app.js
angular.module('app', ['ionic', 'ngCordova', 'ngOpenFB', 'firebase', 'angularMoment', 'app.controllers', 'app.routes', 'app.services', 'app.directives', 'app.filters'])

.run(function($ionicPlatform, ngFB, $ionicSideMenuDelegate, $cordovaLocalNotification) {
  $ionicPlatform.ready(function() {

  // code code code....

  });
})

controllers.js
angular.module('app.controllers', ['ngCordova'])

.controller('firstCtrl', function($scope) {
    // awesome code...

})

.controller('secondCtrl', function($scope) {
    // awesome code...

})

.controller('thirdCtrl', function($scope) {
    // awesome code...

});

index.html
<script src="js/app.js"></script>
<script src="js/controllers.js"></script>
<script src="js/routes.js"></script>
<script src="js/services.js"></script>
<script src="js/directives.js"></script>
<script src="js/filters.js"></script>

How can I separate out my controllers into individual .js files for each controller?

A:

firstCtrl.js
angular.module('app.controllers')
.controller('firstCtrl', function($scope) {
    // awesome code...
})

secondCtrl.js
angular.module('app.controllers')
.controller('secondCtrl', function($scope) {
    // awesome code...
})

index.html
<script src="js/app.js"></script>
<script src="js/firstCtrl.js"></script>
<script src="js/secondCtrl.js"></script>

