var app = angular.module('myApp', ['ngLoadScript']);
app.config(function($routeProvider, $controllerProvider, $compileProvider, $filterProvider)
🎟 controllerProvider = $controllerProvider;app.compileProvider = $compileProvider;
app.routeProvider = $routeProvider;
fil} app.controller('mainController ', function($scope) {
});
上面這段程式碼寫在myApp.js中,為什麼運行時顯示Uncaught Error: [$injector:modulerr] 錯誤。我想把controllerProvider保存下來,之後有用。這麼做為什麼會出錯?
問題不在
$controllerProvider
,而在$routeProvider
。你看這:你沒有引入
ngRoute
,却要注入$routeProvider
,你覺得能成麼?