I worked on angular (2+) but i am newbie for angularJS. I am confused with how controllers are created in our project. I have learnt that controllers are created with below syntax
AppConfig.controller("MasterController", ["$scope", "$http", "$window", "$rootScope", "$filter", "$uibModal", "$q",
function ($scope, $http, $window, $rootScope, $filter, $uibModal, $q) {//to do}]
But, for uibModal controller, in our project i can't find the above syntax, instead controller are created as shown below for below uibmodal
var modalInstance = $uibModal.open({
animation: true,
backdrop: 'static',
keyboard: false,
templateUrl: 'Main_template.html',
size: "slxModelPop",
controller: MainController,
resolve: {
scope: function () {
return $scope;
},
scopeData: function () {
return scopeData
}
}
});
The controller is defined as
var MainController= ["$scope", "$uibModal", "$uibModalInstance", "$http", "$compile", "$log", "$filter", "$window", "scope", "$timeout", "scopeData",
function ($scope, $uibModal, $uibModalInstance, $http, $compile, $log, $filter, $window, scope, $timeout, scopeData) {//to do}]
And it works fine, so can we create controller without using the controller constructor?