angularjs basic authentication headers
问题 I'm trying to connect to API and send authentication headers. I'm using Base64 as described here How do I get basic auth working in angularjs? function Cntrl($scope, $http, Base64) { $http.defaults.headers.common['Authorization'] = 'Basic ' + Base64.encode('----myusername----' + ':' + '----mypass---'); $http({method: 'GET', url: 'https://.../Category.json'}). success(function(data, status, headers, config) { console.log('success'); }). error(function(data, status, headers, config) { alert