[英]AngularJS HTTP Interceptors
I was wondering if HTTP Interceptors
in AngularJS cause a performance hit? 我想知道AngularJS中的
HTTP Interceptors
是否会导致性能下降?
I want to intercept requests
and prepend the absolute URL: 我想拦截
requests
并添加绝对URL:
angular.module('app').config(['$httpProvider', function ($httpProvider) {
$httpProvider.interceptors.push(function () {
return {
request: function (config) {
config.url = 'http://localhost:9060/' + config.url;
}
};
});
}]);
除非您在拦截器中进行疯狂且费时的操作,否则与其他任何应用程序相比,拦截器的实际调用在您的应用程序中都是可以忽略的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.