gpt4 book ai didi

javascript - ngDialog 模式不弹出

转载 作者:行者123 更新时间:2023-12-03 08:18:34 26 4
gpt4 key购买 nike

我试图通过单击按钮来显示一个简单的模式。模态框不会弹出。它在同一现有窗口上显示内容。(附有快照)

我的代码如下:

index.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>

app.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>

请告诉我为什么模式不起作用。

Screenshot

最佳答案

您应该在 header 中包含 ngDialog 的 css 文件:

<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>

<link rel="stylesheet" th:href="@{/css/ngDialog.css}" href="../../css/ngDialog.css" > </link>
<link rel="stylesheet" th:href="@{/css/ngDialog-theme-default.css}" href="../../css/ngDialog-theme-default.css" > </link>
</head>

关于javascript - ngDialog 模式不弹出,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33823085/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com