var app = angular.module('myApp', ['ngLoadScript']);
app.config(function($routeProvider, $controllerProvider, $compileProvider, $filterProvider)
{
app.controllerProvider = $controllerProvider;
app.compileProvider = $compileProvider;
app.routeProvider = $routeProvider;
app.filterProvider = $filterProvider;
});
app.controller('mainController', function($scope) {
});
The above code is written in myApp.js, why does the Uncaught Error: [$injector:modulerr] error appear when running. I want to save the controllerProvider and use it later. Why is this wrong?
That’s not the problem
$controllerProvider
,而在$routeProvider
. Look at this:You haven’t introduced it
ngRoute
,却要注入$routeProvider
, do you think it can be done?