2016-10-27 3 views
1

Ich habe eine modale Funktion, die ein Problem hat, wenn ich verkleinere. Es liegt daran, dass der Controller nicht in Klammern eingeschlossen ist.Wie wickeln Sie einen uibModal-Controller in Klammern, um ihn vor dem Reduzieren zu schützen

Bei einem normalen Controller, würde ich ".Controller ('Strg', [ '$ scope', function ($ scope) {});

Aber mit meinem modal, ruft sie nur eine gerade Funktion :

 var modalInstance = $uibModal.open({ 
      animation: true, 
      backdrop: 'static', 
      keyboard: false, 
      templateUrl: 'questionsModal.html', 
      controller: function($scope, $uibModalInstance, SweetAlert) { 

ich folgendes versucht:.

  var modalInstance = $uibModal.open({ 
       animation: true, 
       backdrop: 'static', 
       keyboard: false, 
       templateUrl: 'questionsModal.html', 
       controller: ('', [ '$scope', function($scope) {}]) 

Aber es funktioniert nicht

Antwort

2

Hier gehen Sie:

var modalInstance = $uibModal.open({ 
       animation: true, 
       backdrop: 'static', 
       keyboard: false, 
       templateUrl: 'questionsModal.html', 
       controller: ['$scope', '$uibModalInstance', 'SweetAlert', function($scope, $uibModalInstance, SweetAlert) { 
       }] 
+0

Danke, Beslinda! – cnak2

+0

Ich bin froh, dass ich geholfen habe –

Verwandte Themen