Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

SOLVED: I am not able to get the Form value in Angular 2

Dhileepan S J:

I am beginner in Angular 2 and I am trying get a value of textbox in component and I really don't know how to get it.

HTML :







component.ts :


import { Component } from "@angular/core"
import { FormControl, FormGroup, FormBuilder, Validator, Validators,ReactiveFormsModule } from "@angular/forms";
import { customer } from '../model/customerModel'
import { Router } from "@angular/router";

export class regComponent
{
private Customer:customer;
private regForm:FormGroup;
private firstName:FormControl;

constructor (private formBuilder:FormBuilder,private router:Router)
{

this.firstName=new FormControl('',[Validators.required])

this.regForm=formBuilder.group({
firstName:this.firstName
})

console.log(this.regForm.value);
}

here I am getting empty value in the console. Please help in this regard



Posted in S.E.F
via StackOverflow & StackExchange Atomic Web Robots
This Question have been answered
HERE


This post first appeared on Stack Solved, please read the originial post: here

Share the post

SOLVED: I am not able to get the Form value in Angular 2

×

Subscribe to Stack Solved

Get updates delivered right to your inbox!

Thank you for your subscription

×