[英]How to set common header for http
I am setting comon header for all $htpp calls using angular js 我正在使用angular js为所有$ htpp调用设置comon标头
angular.module('sample module').run(function($http) {
$http.defaults.headers.common['token']='ticket' ;
});
But i need to set for all html files also common header for security reasons ,that will be validating the service . 但是出于安全原因,我需要为所有html文件设置通用的标头,这将验证服务。
Is that possible ,please suggest 有可能吗,请提示
Try set common header for all requests like this 尝试为所有这样的请求设置通用标头
angular.module('sample module').config(['$httpProvider', function ($httpProvider) {
$httpProvider.defaults.headers.common['token']='ticket';}]);
Hope it help to you. 希望对您有帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.