Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import { HttpClient, HttpHeaders } from '@angular/common/http';
- export class LoginComponent {
- constructor(
- private http: HttpClient
- ) {}
- doLogin() {
- const credentials = {
- username: 'john_smit',
- password: 'secret123'
- };
- this.http
- .post(`http://localhost:8080/login`, credentials, {
- headers: new HttpHeaders().set('Content-Type', 'application/json')})
- .subscribe(d => {
- console.log(d);
- });
- }
- }
Add Comment
Please, Sign In to add comment