Virajsinh

Angular_Form_ts

Feb 28th, 2020
317
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import { Component, OnInit, ViewChild } from '@angular/core';
  2. import { NgForm } from '@angular/forms';
  3.  
  4. @Component({
  5.   selector: 'app-register',
  6.   templateUrl: './register.component.html',
  7.   styleUrls: ['./register.component.scss']
  8. })
  9. export class RegisterComponent implements OnInit {
  10.  
  11.   @ViewChild('f', { static: false }) signupForm: NgForm;
  12.  
  13.   constructor(private apiService: ApiService) { }
  14.  
  15.   ngOnInit() {
  16.   }
  17.  
  18.   signup(){
  19.     if(this.signupForm.valid == true)
  20.     {
  21.       console.log(this.signupForm.value);
  22.     }else{
  23.       console.log("Form is Not Valid.");
  24.     }
  25.   }
  26.  
  27. }
Add Comment
Please, Sign In to add comment