【发布时间】:2016-06-25 08:26:11
【问题描述】:
我正在使用 c3-angular.min.js。在客户端,我编写了一个拦截器,用于向发送到 api 服务器的每个请求添加授权标头。 除了通过 C3.js 发出的请求之外,所有 http 请求似乎都有授权。结果,我的图表收到 401 错误。没有太多可用的文档。
如何在 c3.js 发出的请求上添加 http 请求标头。
$scope.config={
bindto: '#div1_chart',
data: {
'x':'x',
'types':{'count':'area'},
'names':{'count':'hits/day'},
'url':$scope.base_url,
'mimeType':'json'
},
axis : {
x : {
type : 'timeseries',
tick : {
rotate: 45,
multiline: false,
fit: false,
format : $scope.format
},
height:100
}
}
};
$scope.showGraph = function() {
$scope.chart = c3.generate($scope.config);
}
【问题讨论】: