Làm cách nào để tạo một tiêu đề chung tương tự như jQuery bằng AngularJS?Tiêu đề chung cho AngularJS post
Something như thế này:
$.ajaxSetup({
beforeSend: function (xhr) {
xhr.setRequestHeader('Requested-With', 'XMLHttpRequest');
xhr.setRequestHeader('__RequestVerificationToken', 'abc123');
}
});
Ngay bây giờ tôi làm điều này:
$http({
url: 'mysite.com/',
method: 'POST',
data: 'data',
headers: {'Content-Type': 'application/x-www-form-urlencoded'}
})
phần đọc Thiết Headers trong tài liệu – charlietfl