我正在尝试使AlertifyJS(v1.9.0)在我的angular 2应用程序中工作。我在vendor.ts中有以下内容
import "alertifyjs/build/alertify.min.js";
import "alertifyjs/build/css/alertify.min.css";
Run Code Online (Sandbox Code Playgroud)
通过以下调用来提醒
openConfirmationDialog(message: string, okCallback: () => any) {
alertify.confirm(message, function (e: any) {
if (e) {
okCallback();
} else {
}
});
}
Run Code Online (Sandbox Code Playgroud)
但不断得到错误
: Cannot find name 'alertify'.
Run Code Online (Sandbox Code Playgroud) 我使用alertify.error来显示错误消息.我想知道是否有任何方法可以更改显示在其中的文本的字体颜色?
$("#btn_submit").click(function(){
alertify.prompt("Please enter note/remarks for this Form:", function (e, value) {
$("#alertify-ok").val('Submit Form'); //change button text
if (e) {
alertify.success("Form has been submitted");
} else {
alertify.error("Your form is not submitted");
}
});
Run Code Online (Sandbox Code Playgroud)
用于alertify提示对话框的HTML
<button id="alertify-ok" class="alertify-button alertify-button-ok" type="submit">
OK
</button>
Run Code Online (Sandbox Code Playgroud)
用户单击"提交"按钮时会出现提示.尝试使用下面的更改按钮文本,但它不起作用
$("#alertify-ok").val('Submit Form'); //change button text
Run Code Online (Sandbox Code Playgroud)
小提琴 - 我需要将默认OK按钮文本更改为其他内容
如何更改按钮文本Submit Form而不是默认值OK?
我正在使用Alertify js 1.6.1在用户离开页面时显示对话框.除了Ok和Cancel之外,我还需要在alertify js确认对话框中添加一个额外的按钮"continue".有没有办法添加自定义按钮功能?如果您有任何想法,请告诉我.谢谢
我正在使用angular.js和alertify.js列出这里的用户:
问题是:单击删除菜单后,会出现一个确认窗口,然后单击"确定"按钮后,删除的行仍然存在,直到再次单击"删除"按钮.
看来,Angular不知道何时更新自己.任何人都知道如何在Angular中正确"重新加载"这个用户表?
这是我的html文件:
<table class="table">
<tbody>
<tr ng-repeat="user in users">
<td>{{ user.name }}</td>
<td>{{ user.age }}</td>
<td>
<button class="btn btn-danger" ng-click="removeUser($index)">
Delete
</button>
</td>
</tr>
</tbody>
</table>
Run Code Online (Sandbox Code Playgroud)
这是我的函数app.js:
var app = angular.module('demo', []);
app.controller('DemoCtrl', function($scope, $http) {
$scope.users = [
{name: "Jack", age: 10},
{name: "Bart",age: 20},
{name: "Griffin",age: 40}]
$scope.removeUser = function(index) {
alertify.confirm("You Sure ?").set('onok', function() {
$scope.users.splice(index, 1)
})
}
});
Run Code Online (Sandbox Code Playgroud)