【发布时间】:2021-01-08 11:32:33
【问题描述】:
我正在尝试使用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');
},
},
});
});
}
它会弹出以下错误,
我寻找一些实现这个但没有运气的例子。谁能帮我解决这个问题?
【问题讨论】:
-
正如@Moshezauros 所提到的,该库旨在与AngularJS 一起使用。如果您在项目中使用 ng-bootstrap:我在这里为类似问题提供了解决方案:stackoverflow.com/a/48761912/184245
标签: angular typescript confirm