2016-07-07 7 views
0

Ich möchte ein Popup erstellen, um E-Mails zu senden? Möchten Sie wirklich eine E-Mail mit Ja oder Nein senden? Bitte helfen Sie mir M diesen Fehler zu bekommen Unbekannter Provider: $ 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!"); 
         } 
        ); 
      }; 
+0

Ich sehe nicht, dass Sie das Hinzufügen '$ modalProvider' als Abhängigkeit. –

+1

Mögliches Duplikat von [Unbekannter Provider: $ modalProvider <- $ modaler Fehler mit AngularJS] (http://stackoverflow.com/questions/18733680/unknown-provider-modalprovider-modal-error-with-angularjs) –

+0

Dieser Code konnte nicht eingegeben werden. t erzeugt diesen Fehler, da Sie nicht versuchen, '$ modal' irgendwo einzufügen, und der Code verwendet keinen Service' $ modal'. 'modals' ist nicht das Gleiche. – Claies

Antwort

0

Versuchen $uibModal's, es ist sehr einfach, Beispiel:

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; 
    }; 

}); 
Verwandte Themen