我有在角供應商的問題,我得到這個錯誤:Angular.js - 錯誤與providerInjector
Row 2696: Error: Unknown provider: a
使用unminified角v 1.06,行2696:
providerInjector = createInternalInjector(providerCache, function() {
throw Error("Unknown provider: " + path.join(' <- '));
}),
這是代碼:
var myApp = angular.module('myApp', [], function ($interpolateProvider) {
$interpolateProvider.startSymbol('{[{');
$interpolateProvider.endSymbol('}]}');
});
myApp.directive('buttonsRadio', function() {
[...]
});
myApp.controller('MainController', function MainController ($scope) {
[...]
})
任何想法?
編輯:添加錯誤消息:
Error: Unknown provider: aProvider <- a
createInjector/providerInjector<@/libs/angular.js:2696
[email protected]/libs/angular.js:2824
createInjector/instanceCache.$injector<@/libs/angular.js:2701
[email protected]/libs/angular.js:2824
[email protected]/libs/angular.js:2842
[email protected]/libs/angular.js:2874
@/libs/angular.js:4759
applyDirectivesToNode/nodeLinkFn/<@/libs/angular.js:4338
[email protected]/libs/angular.js:138
[email protected]/libs/angular.js:4323
[email protected]/libs/angular.js:3969
[email protected]/libs/angular.js:3972
[email protected]/libs/angular.js:4354
[email protected]/libs/angular.js:3969
[email protected]/libs/angular.js:3874
bootstrap/resumeBootstrapInternal/</<@/libs/angular.js:963
[email protected]/libs/angular.js:8011
[email protected]/libs/angular.js:8091
bootstrap/resumeBootstrapInternal/<@/libs/angular.js:961
[email protected]/libs/angular.js:2857
bootstrap/[email protected]/libs/angular.js:960
[email protected]/libs/angular.js:973
[email protected]/libs/angular.js:934
@/libs/angular.js:14756
f.Callbacks/[email protected]://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js:2
f.Callbacks/[email protected]://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js:2
[email protected]://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js:2
[email protected]://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js:2
/libs/angular.js
Line 5704
我實際上使用源代碼而不會造成混淆。我想我試過這個解決方案(會再試一次),它可能是別的嗎? – dani 2013-04-26 18:02:40
其他選項可能是你傳遞了一個名爲'a'的函數,其中AngularJS期望函數具有可注入的參數(例如,即使在指令定義對象中的控制器函數)。嘗試將部分代碼發佈到Plunker以重現錯誤。在這種情況下,你可以更容易找到一個地方+我們可以看看並給你建議。 – 2013-04-26 18:15:19
似乎我擺脫了一個錯誤。我是否需要將$ interpolateProvider注入指令和控制器以及可能? – dani 2013-04-26 18:16:58