Controllers are used to control the flow of data in AngularJS application. ng-controller directive is used to define controller. Controllers…