未知提供者:$ modalProvider< - $ modal< - userDetailController

时间:2016-07-07 07:55:20

标签: angularjs

我想创建一个弹出窗口来发送电子邮件?你确定要发送电子邮件是或否?请帮帮我M得到此错误未知提供者:$ modalProvider< - $ modal< - userDetailController。

define([
    'angular',
    './module'
], function (angular, module) {
    'use strict';

    module.controller('userDetailController', [
        '$scope',
        'userDetails',
        'navigationStateService',
        '$translate',
        'ngDialog',  
        function ($scope,userDetails,navigationStateService, $translate,ngDialog) {

            $scope.user = userDetails.getSelectedUser();



 $scope.openContactForm = function() {

                 var promise = modals.open(
                         "confirm",
                         {
                             message: "Are you sure you want to taste that?!"
                         }
                     );
                 promise.then(
                         function handleResolve( response ) {
                             console.log( "Confirm resolved." );
                         },
                         function handleReject( error ) {
                             console.warn( "Confirm rejected!" );
                         }
                     );
            };

1 个答案:

答案 0 :(得分:0)

试试$uibModal's ,这很简单,例如:

angular.module('ui.bootstrap.demo').controller('ModalDemoCtrl', function ($scope, $uibModal, $log) {
  $scope.animationsEnabled = true;
//open modal
  $scope.open = function (size) {

    var modalInstance = $uibModal.open({
      animation: $scope.animationsEnabled,
      templateUrl: 'myModalContent.html',
      controller: 'ModalInstanceCtrl',
      size: size,
      resolve: {
        //resolve
      }
    });

    modalInstance.result.then(function (selectedItem) {
      //.then
    }, function () {
      $log.info('Modal dismissed at: ' + new Date());
    });
  };

  $scope.toggleAnimation = function () {
    $scope.animationsEnabled = !$scope.animationsEnabled;
  };

});