Hi All,
I have java REST services and consumer in Angularjs 1.3. Services are JSON based and expect BASIC authentication (username-password). In AgJs 1.3, I used Base64 factory code (found on google) for creating basic authentication token from username and password and able to consume services SUCCESSFULLY. I read HTTP class in AgJs 2.0 documentation but I didn't find any information about basic authentication. Could anybody please provide sample code to consume REST services in Angularjs 2.0 using BASIC authentication? Thanks in advance! Best Regards! My AgJs 1.3 code: var url = "http://x.x.x.x:xxxx/data/" + number; $http.defaults.headers.common['Authorization'] = 'Basic ' + Base64.encode('username' + ':' + 'password'); $http.defaults.headers.common['Content-Type'] = 'application/json'; $http({ method: 'GET', url: url }). success(function (data, status, headers, config) { alert(data); }). error(function (data, status, headers, config) { alert("error: " + data); }); -- You received this message because you are subscribed to the Google Groups "AngularJS" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/angular. For more options, visit https://groups.google.com/d/optout.
