在我的app.js中,我有

var app = angular.module("atlas", ["ngRoute", "ngDialog"]);

对于我的 Controller
app.controller("nodeController", function ($scope, $http, ngDialog)
ngDialog产生错误:
>Error: [$injector:unpr] Unknown provider: ngDialogProvider <- ngDialog <-nodeController
我也用了reftenced的cssjs文件
<link rel="stylesheet" href="~/Content/ngDialog-custom-width.css" />
<link rel="stylesheet" href="~/Content/ngDialog-theme-default.min.css" />
<link rel="stylesheet" href="~/Content/ngDialog-theme-plain.min.css" />
<link rel="stylesheet" href="~/Content/ngDialog.css" />

<script src="~/Scripts/jquery-2.1.3.min.js"></script>
<script src="~/Scripts/angular.js"></script>
<script src="~/Scripts/angular-route.js"></script>
<script src="~/Scripts/ngDialog.js"></script>

我在stackoverflow上尝试了所有答案,但没有一个对我有用

最佳答案

问题是ngDialogProvider的配置
var app = angular.module("atlas", ["ngRoute", "ngDialog"]);之后

我们必须使用:

app.config(["ngDialogProvider", function (ngDialogProvider) {
    ngDialogProvider.setDefaults({
        className: "ngdialog-theme-default",
        plain: false,
        showClose: true,
        closeByDocument: true,
        closeByEscape: true,
        appendTo: false,
        preCloseCallback: function () {
            console.log("default pre-close callback");
        }
    });
}]);

10-06 15:44