I'm starting in Angular and in some cases I saw that parameters are passed in the bracket of the module and in other cases in the function, and in the function I have already seen 2 forms of declaration.
Example Module:
angular.module('starter', ['ionic', 'starter.controllers', 'starter.services', 'ui.utils.masks', 'ngCordova', 'angular-md5', 'ngMessages', 'angularSoap'])
Example Function 1:
.config(function ($stateProvider, $urlRouterProvider, $ionicConfigProvider){...}
.controller('LoginCtrl', function ($scope, $rootScope, $pouchDB){...}
Example Function 2:
.controller('GreetingController', ['$scope, $any', function($scope, $any){...}
Someone could explain me:
- What is the difference between the declaration of Function 1 and Function 2 (why do these two forms exist and what would be the practical impact in choosing one or the other)?
- What is the difference between passing these parameters on the module and on the functions?
- Are there any links between them?
- What is happening and what can happen in these parameters
Do not just stick to my questions. The more information, the better, but at first my doubts are these above.