'un 'üstbilgileri' özelliği okunamıyor Bu bir Hata alıp, bir AJAX Döndürücü yükleme kodunu uygulamaya çalışırken bilinmeyen nedenlerle alıyorum.AngularJS Interceptor TypeError: Tanımlanmamış
Başlığın nerede tanımlanması gerektiğini anlamıyorum. console.log(config)
yaptım ama orada headers: accept: text/html
değerini görebiliyorum. Eğer (daha iyi kod okunabilirliği için hizmette $ rootScope sarma) önleyicilerin kullanarak bir değer değiştirici nasıl uygulanacağı konusunda tam bir örnek var Burada
/**
* Spinner Service
*/
//Spinner Constants
diary.constant('START_REQUEST','START_REQUEST');
diary.constant('END_REQUEST','END_REQUEST');
//Register the interceptor service
diary.factory('ajaxInterceptor', ['$injector','START_REQUEST', 'END_REQUEST', function ($injector, START_REQUEST, END_REQUEST) {
var $http,
$rootScope,
myAjaxInterceptor = {
request: function (config) {
$http = $http || $injector.get('$http');
if ($http.pendingRequests.length < 1) {
console.log(config);
$rootScope = $rootScope || $injector.get('$rootScope');
$rootScope.$broadcast(START_REQUEST);
}
}
};
return myAjaxInterceptor;
}]);
diary.config(['$httpProvider', function ($httpProvider) {
$httpProvider.interceptors.push('ajaxInterceptor');
}]);
bu hatayı hangi satır? – Grundy
Hayır Hattı Numarası ::: ====== açısal TypeError tarafından gösteri: processQueue (angularjs en : $ get.serverRequest (9366 angularjs) de tanımlanmamış malı 'başlıklarını' okunamadı: 13248) angular.js'de: 13264 , Scope. $ Get.Scope. $ Eval (angular.js: 14466) Scope'da , Scope. $ Get.Scope. $ Digest (angular.js: 14282) . get.Scope. $ apply (angular.js: 14571) bootstrapApply (angular.js: 1455) at object.invoke (angular.js: 4203) doBootstrap'te (angular.js: 1453) önyükleme sırasında (açısal .js: 1473) – ChanX