Angular JS - 用咖啡脚本确认对话框

时间:2016-06-15 15:31:57

标签: javascript angularjs coffeescript

我试图使用angular提供的$ confirm服务。以下咖啡脚本引发错误:

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

错误:

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

1 个答案:

答案 0 :(得分:1)

请参阅[HttpPost] [Produces("application/json")] public IActionResult Post([FromBody] RequestClass RequestData) { var stream = this.HttpContext.Request.Body; stream.Position = 0; using (var reader = new StreamReader(stream)) { string body = reader.ReadToEnd(); Telemetry.TrackTrace(body, Microsoft.ApplicationInsights.DataContracts.SeverityLevel.Information); } return Ok(); } 个文档,了解如何在整个应用中注入服务:https://schlogen.github.io/angular-confirm/

  1. 向您的模块添加服务
  2. $confirm

    1. 注入您的控制器
    2. angular.module('myApp', ['angular-confirm']);