简体   繁体   中英

How to do user login authentication and user session in Angularjs?

I am new to Angularjs and I am getting problem in hitting my login rest service which is written in Java. Please tell me how to send authentication headers and data to my service so that I can successfully login and maintain the session of the user too.

To get started, try $http

Sample from documentation

var req = {
 method: 'POST',
 url: 'http://example.com',
 headers: {
   'Content-Type': undefined
 },
 data: { test: 'test' }
}

$http(req).then(function(){ /* success */}, function(){ /* error */});

An yes, try to search something like angular authentication example

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM