我要连接的网站需要用户名和密码。我该如何实现呢?
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.3.14/angular.min.js"/>
<div ng-app="myApp" ng-controller="customersCtrl"></div>
<script>
var app= angular.module('myApp',[]);
app.controller('customersCtrl',function($scope,$http){
$http.get("http://xxx").success(function (response) {
$scope.names = response.records;
});
});
</script>
答案 0 :(得分:0)
您需要通过您的网址传递您的用户名和密码,例如:
<script>
var app= angular.module('myApp',[]);
app.controller('customersCtrl',function($scope,$http){
$http.get("http://www.myWebPage/USERNAME:PASSWORD@blahblah.com").success(function (response) {
$scope.names = response.records;
});
});
</script>