I'm learning Angular and I've seen some examples where the $routeProvider is configured like this:
app.config(function ($routeProvider) {
$routeProvider.
when("/drivers", { templateUrl: "partials/drivers.html", controller: "driversController" }).
when("/drivers/:id", { templateUrl: "partials/driver.html", controller: "driverController" }).
otherwise({ redirectTo: "/drivers" });
});
And in other examples it is configured like this:
app.config(['$routeProvider', function ($routeProvider) {
$routeProvider.
when("/drivers", { templateUrl: "partials/drivers.html", controller: "driversController" }).
when("/drivers/:id", { templateUrl: "partials/driver.html", controller: "driverController" }).
otherwise({ redirectTo: "/drivers" });
}]);
Both of them seem to work the same way, but I would like to know what is the difference between calling the config by sending an Array with the '$routeProvider' as a string first and then the function and calling by just using function directly as in the first example.
Thanks.