2016-05-17 4 views
0

Broken Interceptor erkannt: Config Objekt nicht in der Ablehnung geliefert: Ich bekomme diesen Fehler, wenn ich die Post-Methode aufrufen.Broken Interceptor erkannt: Config-Objekt nicht in der Ablehnung geliefert:

Ich habe gegeben Dienste, Controller und PHP-Code

Dienstleistungen

angular.module('sbAdminApp') 
.factory('Branch', function($resource){ 
    return $resource('api/branchdetails/:branch_id',{branch_id:'@_branch_id'},{ 
     update: { 
      method: 'PUT' 
     } 
    }); 
}) 
.service('popupService',function($window){ 
    this.showPopup=function(message){ 
     return $window.confirm(message); 
    } 
}); 

-Controller

angular.module('sbAdminApp') 
.controller('BranchDetailsController', function($scope,$state,$stateParams,$window,Branch){ 

     $scope.branch = new Branch(); 

     $scope.addBranch=function(){     
      $scope.branch.$save(function(){ 
       $state.go('branchdetails'); 
     }); 
    } 
}); 

PHP-Code

<?php 

require_once('Slim/Slim.php'); 
require_once('dbconnection.php'); 

$app = new Slim(); 
$app->post('/branchdetails','addBranch'); 
$app->run(); 
function addBranch() { 
    $request = Slim::getInstance()->request(); 
    $branch = json_decode($request->getBody()); 
    $sql = "INSERT INTO branch(branch_name, branch_address, branch_phno, branch_mobileno, branch_contactperson, branch_createdate, branch_modifieddate) VALUES (:branch_name,:branch_address, :branch_phno, :branch_mobileno, :branch_contactperson, :branch_createdate, :branch_modifieddate)"; 
    try { 
     $db = getConnection(); 
     $stmt = $db->prepare($sql); 
     $stmt->bindParam("branch_name", $branch->branch_name); 
     $stmt->bindParam("branch_address", $branch->branch_address); 
     $stmt->bindParam("branch_phno", $branch->branch_phno); 
     $stmt->bindParam("branch_mobileno", $branch->branch_mobileno); 
     $stmt->bindParam("branch_contactperson", $branch->branch_contactperson); 
     $stmt->bindParam("branch_createdate", $branch->branch_createdate); 
     $stmt->bindParam("branch_modifieddate", $branch->branch_modifieddate); 
     $stmt->execute(); 
     $branch->branch_id = $db->lastInsertId(); 
     $db = null; 
     echo json_encode($branch); 
    } catch(PDOException $e) { 

     echo '{"error":{"text":'. $e->getMessage() .'}}'; 
    } 

} 



?> 

Antwort

1

Irgendwo in Ihrem Code Sie haben eine interceptor für $httpProvider, die keinen richtigen Antwortfehler Abschnitt, so etwas wie dies hat:

(function() { 
    angular.module('App')    
      .config(['$httpProvider', httpProviderConfig]); 

    function httpProviderConfig($httpProvider) { 

     var interceptor = ['$rootScope', '$q', function ($rootScope, $q) { 

      return { 

       'responseError': function (rejection) { 

        return $q.reject(rejection); 
       } 
      }; 
     }]; 

     $httpProvider.interceptors.push(interceptor); 
    } 
})(); 
+0

i AngularJS neu bin, so bitte helfen Sie mir, dass, wenn ich diese Abfangjäger halten muß ?? –

+0

sogar ich bekomme einen anderen Fehler wie diese "SyntaxError: Unerwartete Token S bei Object.parse (native)" –

+0

Ich habe nicht gesagt, halten Sie den Interceptor, sagte ich finde es, suchen Sie alle Ihre eckigen Dateien für '$ httpProvider' und sehen wann ich benutzt wurde? – Exlord

Verwandte Themen