我是Angular的新手。我有以下Angular JS(v.1.7)ui-router
.state('helpPage', {
url: "/help",
data: {
roles: []
},
views: {
helpDoc: {
templateUrl: 'app/modules/help/help.tpl.html',
controller: 'helpCtrl'
}
}
})
[当用户点击此页面时,我要检索标题。我可以在Controller或ui-route的resolve方法本身中获取它们吗?
尝试过HttpInterceptor,但没有帮助。
非常感谢您的帮助。
使用$ http headers
对象的response
属性:
$http.head(url).then(function(response) {
var headerGetter = response.headers;
console.log(headerGetter("headerName"));
});
有关更多信息,请参阅