我有一份现有的AngularJS代码,它会进行HTTP GET请求。以下是控制器中相关的一些代码片段:
.controller('imptViewCtrl', ['$scope', '$http',
function ($scope, $http, ) {
var url = $configuration.webroot + '/impt/list?list=testlist';
$http.get(url).then(function (response) {
tableData = response.data;
});
}]);
我想要在HTTP GET请求中添加HTTP基本认证。用户名为foo
,密码为bar
。如何实现?