Guest User

Untitled

a guest
Oct 17th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. import { HttpClient, HttpHeaders } from '@angular/common/http';
  2.  
  3. export class LoginComponent {
  4. constructor(
  5. private http: HttpClient
  6. ) {}
  7.  
  8. doLogin() {
  9. const credentials = {
  10. username: 'john_smit',
  11. password: 'secret123'
  12. };
  13.  
  14. this.http
  15. .post(`http://localhost:8080/login`, credentials, {
  16. headers: new HttpHeaders().set('Content-Type', 'application/json')})
  17. .subscribe(d => {
  18. console.log(d);
  19. });
  20. }
  21. }
Add Comment
Please, Sign In to add comment