【发布时间】:2017-09-13 06:49:42
【问题描述】:
我想将配置注入到我的 Angular 应用程序中。该应用程序还包含一个运行对象。
但是当我添加配置选项时,我得到一个 $injector:modulerr 错误。而且我找不到错误。
var myApp = angular.module('myApp',[
'ngAnimate',
'ui.bootstrap',
'ui.router',
'angular.filter',
'angularUtils.directives.dirPagination',
'validation.match',
'ngSanitize',
'ngCookies',
'pascalprecht.translate',
'toggle-switch',
'angucomplete-alt',
'cgPrompt',
'dndLists',
'ngFileUpload',
'ui.router.breadcrumbs',
'angular-bind-html-compile',
'rzModule', // range slider (i.e. for price filter)
'ngFileSaver',
'angular-input-stars',
'textAngular',
'textAngular-uploadImage'
]);
myApp.config(function($provide) {
$provide.decorator('taOptions', function($delegate) {
$delegate.toolbar[1].push('uploadImage');
return $delegate;
});
});
myApp.run(['$rootScope', '$window', '$location', '$stateParams', '$api', '$translate', '$transitions', '$state',
function($rootScope, $window, $location, $stateParams, $api, $translate, $transitions, $state) {
//rootscope
}]);
关于 textAngular-uploadImage 模块 (https://github.com/mrded/textAngular-uploadImage)。当我删除配置选项时,我的应用程序运行良好,但当然,我不能使用该模块。
这是什么原因?我在 html 中包含了所有必需的文件,textAngular (https://github.com/textAngular/textAngular) 工作正常。
我该如何解决这个问题?或者 textAngular 中的普通上传功能还有其他选项吗?我也尝试了这个解决方案 (https://github.com/textAngular/textAngular/issues/139#issuecomment-111205679),但我得到了同样的错误。
【问题讨论】:
-
你试过 myApp.config(['$provide',function($provide){ //code here }])
-
您没有提供完整的错误信息。它包含解析它的所有必要信息(它实际上是一个指向以可读形式显示它的页面的 URL)。
标签: angularjs textangular