Advertisement
Guest User

Untitled

a guest
Aug 21st, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. import { Component, OnInit } from '@angular/core';
  2. import { FormGroup, FormBuilder, Validators } from '@angular/forms';
  3.  
  4. @Component({
  5. selector: 'app-loginform',
  6. templateUrl: './loginform.component.html',
  7. styleUrls: ['./loginform.component.css']
  8. })
  9. export class LoginformComponent implements OnInit {
  10.  
  11. loginForm: FormGroup;
  12. constructor(private fb: FormBuilder) {
  13. }
  14. ngOnInit() {
  15. this.loginForm = this.fb.group({
  16. username: [null, [Validators.required, Validators.minLength(4)]],
  17. password: [null, [Validators.required, Validators.minLength(4),
  18. Validators.maxLength(8)]]
  19. })
  20. console.log(this.loginForm);
  21. }
  22. loginUser() {
  23. console.log(this.loginForm);
  24. console.log(this.loginForm.value);
  25.  
  26. }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement