1

I am trying to use angular-confirm. But it's documentation is not clear. I try to implement this as follows,

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

In button click (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');
        },
      },
    });
  });
}

It popups following error,

enter image description here

I seek some examples that implemented this one but no luck. Can anyone help me to sort out this?

Giannis
  • 1,790
  • 1
  • 11
  • 29
shalitha senanayaka
  • 1,905
  • 20
  • 37
  • 1
    As mentioned by @Moshezauros, this library is intended for use with AngularJS. If you are using ng-bootstrap in your project: I've provided a solution to a similar question here: https://stackoverflow.com/a/48761912/184245 – tilo Jan 08 '21 at 12:01

1 Answers1

2

This library is for AngularJs, which is Angular's predecessor, so you can't use it for an Angular project. You can try one of the other libraries out there suited for Angular - maybe something like angular-confirmation-popover

Moshezauros
  • 2,493
  • 1
  • 11
  • 15