【发布时间】:2019-03-04 11:34:20
【问题描述】:
我在使用 angularJS 显示弹出对话框时遇到问题。我正在尝试使用演示站点进行锻炼。 https://material.angularjs.org/latest/demo/dialog。 以下代码是我的控制器js代码。
(function () {
'use strict';
angular
.module('FramesPopup', ['ngRoute', 'ngMaterial' ])
.controller('PopupController', PopupController);
PopupController.$inject = ['$scope'];
function PopupController($scope, $mdDialog) {
$scope.title = 'PopupController';
$scope.status = ' ';
$scope.customFullscreen = false;
$scope.showAlert = function (ev) {
// Appending dialog to document.body to cover sidenav in docs app
// Modal dialogs should fully cover application
// to prevent interaction outside of dialog
$mdDialog.show(
$mdDialog.alert()
.parent(angular.element(document.querySelector('#popupContainer')))
.clickOutsideToClose(true)
.title('This is an alert title')
.textContent('You can specify some description text in here.')
.ariaLabel('Alert Dialog Demo')
.ok('Got it!')
.targetEvent(ev)
);
};
activate();
function activate() {
console.log("test");
}
}
})();
【问题讨论】:
-
根据这篇文章,github.com/angular/material/issues/1114。我应该为 $mdDialog 添加注入代码..
标签: asp.net angularjs angular-material