Skip to content
Permalink
Browse files

Binding credentials model to the login form.

  • Loading branch information
little-pinecone committed Jan 8, 2019
1 parent 9c06da8 commit c9be87c3acae01148703bbcd449026eb90bccd79
@@ -11,15 +11,27 @@ <h5 class="text-center">Provide your credentials to see the cookies</h5>
<div class="form-group">
<label for="username">Username:</label>
<input id="username" class="form-control" type="text"
placeholder="Username" name="username" required>
placeholder="Username" name="username" required
[(ngModel)]="credentials.username" #username="ngModel">
<div [hidden]="username.valid || username.pristine"
class="text-danger">
Username is required
</div>
</div>
<div class="form-group">
<label for="password">Password:</label>
<input id="password" class="form-control" type="password"
placeholder="Password" name="password" required>
placeholder="Password" name="password" required
[(ngModel)]="credentials.password" #password="ngModel">
<div [hidden]="password.valid || password.pristine"
class="text-danger">
Password is required
</div>
</div>
<div class="text-center">
<button class="btn btn-warning">
<button class="btn btn-warning"
(click)="login()"
[disabled]="!loginForm.form.valid">
<span class="ml-1">Log in</span>
</button>
</div>
@@ -1,4 +1,5 @@
import { Component, OnInit } from '@angular/core';
import { Credentials } from '../../credentials';

@Component({
selector: 'app-login',
@@ -7,9 +8,14 @@ import { Component, OnInit } from '@angular/core';
})
export class LoginComponent implements OnInit {

credentials: Credentials = new Credentials('', '');

constructor() { }

ngOnInit() {
}

public login(): void {
}

}
@@ -0,0 +1,3 @@
export class Credentials {
public constructor(public username: string, public password: string){};
}

0 comments on commit c9be87c

Please sign in to comment.
You can’t perform that action at this time.