我有以下代码来生成对话框,但它没有显示出来。当我单击按钮显示对话框时,我只在页面上看到一个暗层但没有对话框。当我点击暗层时,它会消失。
我在这里声明我的角度模块及其对ngMaterial的依赖。我在这里宣布一个控制器,它取决于" $ mdDialog,$ mdMedia"。
$scope.showAbortSessionForm = function(event){
var useFullScreen = ($mdMedia('sm') || $mdMedia('xs')) && $scope.customFullscreen;
$mdDialog.show({
controller: DialogController,
templateUrl: 'app/views/stop.html',
//template: '<div>testing</div>',
parent: angular.element(document.body),
targetEvent: event,
clickOutsideToClose: true,
fullscreen: useFullScreen
}).then(function(){
$scope.status = "ddddd";
}, function(){
$scope.status = "tttttt";
});
};
function DialogController($scope, $mdDialog) {
$scope.hide = function() {
$mdDialog.hide();
};
$scope.cancel = function() {
$mdDialog.cancel();
};
$scope.answer = function(answer) {
$mdDialog.hide(answer);
};
}
Stop.html
<md-dialog>
<md-content>
<div>
<form>
<div><label>Name:</label></div>
<input type="text" placeholder="name" />
<div><label>B:</label></div>
<textarea type="text" placeholder="blog"></textarea>
<div>
<input type="submit" value="Send">
<input type="reset" value="Reset">
<button>Cancel</button>
</div>
</form>
</div>
</md-content>
</md-dialog>
index.html(这是我点击按钮显示对话框的地方):
<div>
<md-button ng-click="showAbortSessionForm($event)">
Abort
</md-button>
</div>
我该如何解决这个问题?