Model driven form in Angular2 with FormBuilder

Add this code in ts file Now updated to Angular4 import { Component, OnInit } from ‘@angular/core’; import { FormGroup, FormControl, FormBuilder,Validators } from ‘@angular/forms’; @Component({ selector: ‘app-modeldrivenformbuilder’, templateUrl: ‘./modeldrivenformbuilder.component.html’, styleUrls: [‘./modeldrivenformbuilder.component.css’] }) export class ModeldrivenformbuilderComponent implements OnInit { formValue:…

Template driven form in angular2

then code in all app.component.ts file Now updated to Angular4 import { Component } from ‘@angular/core’; @Component({ selector: ‘app-templatedrivenform’, templateUrl: ‘./templatedrivenform.component.html’, styleUrls: [‘./templatedrivenform.component.css’] }) export class TemplatedrivenformComponent { onSubmit(value:any){ alert(“Check console or form value”) alert(value.name) console.log(value.name) } } Finally create…