saravana_pc saravana_pc - 5 months ago 39
AngularJS Question

Angular JS - confirm dialog with coffee script

I'm trying to use the $confirm service provided by angular. The following coffee script throws error:

$scope.showConfirmation = ->
$confirm({text: 'Can we test?'})
.then () -> $log.info("test")


Error:

http://errors.angularjs.org/1.2.14/$injector/unpr?p0=%24confirmProvider%20%3C-%20%24confirm **Cause : <div class="ng-scope" ng-view=""**>

Answer

See here from $confirm docs for how to inject the service for use throughout your app: https://schlogen.github.io/angular-confirm/

  1. Add service to your module

angular.module('myApp', ['angular-confirm']);

  1. Inject into your controller

.controller("Controller", function($confirm) {

Comments