首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >实现Angular Confirm - craftpip

实现Angular Confirm - craftpip
EN

Stack Overflow用户
提问于 2021-01-08 19:32:33
回答 1查看 55关注 0票数 1

我正在尝试使用angular-confirm。但是它的文档并不清楚。我试着按如下方式实现它:

库- https://craftpip.github.io/angular-confirm/

在按钮单击(login.component.ts)中,

代码语言:javascript
复制
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');
        },
      },
    });
  });
}

错误后弹出,

我寻找了一些实现此方法的示例,但没有成功。有人能帮我解决这个问题吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-01-08 19:57:29

这个库是用于AngularJs的,它是Angular的前身,所以您不能将它用于Angular项目。您可以尝试其他适合Angular的库-可能是像angular-confirmation-popover这样的库

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65628183

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档