我正在尝试使用angular-confirm。但是它的文档并不清楚。我试着按如下方式实现它:
库- https://craftpip.github.io/angular-confirm/
在按钮单击(login.component.ts)中,
ButtonOnClickHandler() {
angular.module('myApp', ['cp.ngConfirm'])
.controller('myController', function($scope, $ngConfirm){
$scope.hey = 'Hello there!';
$ngConfirm({
title: 'What is up?',
content: 'Here goes a little content, <strong>{{hey}}</strong>',
contentUrl: 'template.html', // if contentUrl is provided, 'content' is ignored.
scope: $scope,
buttons: {
// long hand button definition
ok: {
text: 'ok!',
btnClass: 'btn-primary',
keys: ['enter'], // will trigger when enter is pressed
action: function(scope) {
$ngConfirm('the user clicked ok');
}
},
// short hand button definition
close: function(scope){
$ngConfirm('the user clicked close');
},
},
});
});
}错误后弹出,

我寻找了一些实现此方法的示例,但没有成功。有人能帮我解决这个问题吗?
发布于 2021-01-08 19:57:29
这个库是用于AngularJs的,它是Angular的前身,所以您不能将它用于Angular项目。您可以尝试其他适合Angular的库-可能是像angular-confirmation-popover这样的库
https://stackoverflow.com/questions/65628183
复制相似问题