Angularjs 未知提供程序:eProvider<;-E
我正在更新旧版Angular JS 1.7应用程序并添加一个。该应用程序在部署到生产环境时使用网页包并进行压缩(请参见下面的:Angularjs 未知提供程序:eProvider<;-E,angularjs,Angularjs,我正在更新旧版Angular JS 1.7应用程序并添加一个。该应用程序在部署到生产环境时使用网页包并进行压缩(请参见下面的:drop\u console=true) 网页包: new TerserPlugin({ terserOptions: { compress: { drop_console: (isProduction) ? true : false, // true }, }, }), angular.modul
drop\u console
=true)
网页包:
new TerserPlugin({
terserOptions: {
compress: {
drop_console: (isProduction) ? true : false, // true
},
},
}),
angular.module('MODULE').factory('myService', ['$mdDialog',
function ($mdDialog) {
return {
...
$mdDialog.show({
controller: DialogController, // bound to dialog controller below
...
});
function DialogController($scope, $mdDialog) { // dependencies injected here
...
我知道Angular需要引用注入的依赖项,.controller('myCtrl',['$scope',function($scope){
,因为缩小会更改依赖项的名称,这可能会导致我得到的错误:
[$injector:unpr] Unknown provider: eProvider <- e ...
当依赖项位于模块中时,如何在它们周围提供引号,函数DialogController($scope,$mdDialog){
?尝试:
$mdDialog.show({
controller: ['$scope', '$mdDialog', DialogController]
...
});
function DialogController($scope, $mdDialog) {/* ...*/}
作为旁注,请避免在服务/工厂内定义对话框