angular.js - angularjs module injection error
为情所困
为情所困 2017-05-15 16:50:34
0
1
644

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?

为情所困
为情所困

reply all(1)
滿天的星座

That’s not the problem$controllerProvider,而在$routeProvider. Look at this:

var app = angular.module('myApp', ['ngLoadScript']);

You haven’t introduced itngRoute,却要注入$routeProvider, do you think it can be done?

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template