我正在使用普通的 ng-dialog 和 Angular 在我的 mvc4 应用程序中显示弹出窗口。这是我的代码
var myAPP = angular.module('myAPP', [ 'ngSanitize', 'jsonDateFilters', 'timer', 'ngDialog']);
myAPP.config(function ($provide, $controllerProvider, compileProvider, ngDialogProvider) {
myAPP.controllerProvider = $controllerProvider;
myAPP.compileProvider = $compileProvider;
ngDialogProvider.setDefaults({
className: 'ngdialog-theme-default',
plain: false,
showClose: true,
closeByDocument: true,
closeByEscape: true,
appendTo: false,
preCloseCallback: function () {
console.log('default pre-close callback');
}
});
我正在尝试打开一个弹出窗口,如下所示
$scope.showAlertDetails = function () {
ngDialog.open({
template: 'firstDialogId',
controller: 'alertEditCtrl',
className: 'ngdialog-theme-default',
scope: $scope, // this line wasn't here before
closeByDocument: false
});
}
我的模板是
<script type="text/ng-template" id="firstDialogId" >
<div class="ngdialog-message">
<h3>ngDialog template</h3>
</div>
<div class="ngdialog-buttons">
<button type="button" class="ngdialog-button ngdialog-button-primary" ng-click="openSecond()">Open next</button>
</div>
</script>
我指的是http://ngmodules.org/modules/ngDialog
AngularJS 没有显示带有预定义脚本模板的弹出窗口,而是将模板 ID 作为 mvc4 中的操作。