Is there a way to include the $http service in the config method? When I try to do so, I encounter an "unknown Provider" error message.
This is the snippet of code causing the issue:
.config(function($http, $routeProvider, $provide) {
$http.get("sampleslist.js").success(function(data) {
var loop = 0, currentRoute;
for (loop = 0; loop < data[loop].pages.length; loop++) {
currentRoute = data[loop].pages;
var routeName = "/" + currentRoute[loop].name;
$routeProvider.when(routeName, {
templateUrl:"/" + currentRoute.name + ".html",
})
}
})
app = {controller: $controllerProvider.register}
})
Any suggestions on how to resolve this issue?