在控制器中调用ng模态时出现问题

trouble with ng-modal while calling it in controller

本文关键字:问题 模态 ng 控制器 调用      更新时间:2023-09-26

以下是我采取的步骤:

1) 我从以下位置下载了脚本文件:https://github.com/doodeec/dcom-angular-dialog

2) 包含在我的网页和应用程序中:

var summariesApp = angular.module('summariesApp', ['ui.bootstrap', 'ngCkeditor', 'dcModal']);

3) 尝试在控制器中使用它:

summariesApp.controller("singleSNPController", function ($scope, $http) {
    $scope.stopLightModal = dialogService.create('../Templates/test.html');

我收到一个错误,没有找到dialogService资源。我知道这个问题有点简单,但我已经被这个问题困扰了一段时间。提前谢谢。

尝试将dialogService注入控制器,如下所示:

summariesApp.controller("singleSNPController", function ($scope, $http, dialogService) {
    $scope.stopLightModal = dialogService.create('../Templates/test.html');

看看这里的例子,你会看到他们是如何将dialogService注入控制器的。

我以前也用过这个。它运行得非常好,并且有很好的记录:

https://github.com/likeastore/ngDialog