我试图在单击按钮时显示一个简单的模式。模态不会弹出。它在同一个现有窗口上显示内容。(附快照)
我的代码如下:
索引.html
<!DOCTYPE html>
<html ng-app="Pcp">
<head>
<script src="js/jquery.min.js"></script>
<script src="js/angular.min.js"></script>
<script type="text/javascript" src="app.js"></script>
<script src="ng-dialog/js/ngDialog.min.js"></script>
<script src="ng-dialog/js/ngDialog.js"></script>
</head>
<body>
<div ng-controller="MainController">
<button ng-click="openTaskForm()">Open</button>
</div>
</body>
</html>
应用程序.js
(function(){
var app = angular.module('Pcp',['ngDialog']);
app.controller('MainController', function($scope, ngDialog)
{
$scope.openTaskForm = function(){
ngDialog.open({template: 'addTaskForm.html'
});
};
}
);
})();
addTaskForm.html
<div>
<h2>Contact us<h2>
<input type="text" placeholder="Name" ng-model="name" />
<input type="text" placeholder="Email" ng-model="email" />
<input type="text" placeholder="Mobile" ng-model="mobile" />
<textarea placeholder="Enter your message or query..." ng-model="message"></textarea>
<div class="ngdialog-buttons">
<button type="button" class="ngdialog-button ngdialog-button-secondary" ng-click=closeThisDialog("Cancel")>Cancel</button>
<button type="button" class="ngdialog-button ngdialog-button-primary" ng-click=confirm("OK")>OK</button>
</div>
</div>
请让我知道为什么模式不起作用。