1
Answer

Getting error when creating property in Angular 2

Karthik Kumar

Karthik Kumar

7y
296
1

 I am trying to build a form using form controller

 
 
registerForm = new FormGroup

Here am getting registerForm property cannot find..please help me am new to this

 

import { Component, OnInit } from '@angular/core';
import{FormGroup, FormControl}from '@angular/forms'

@Component({
selector: 'my-app',
templateUrl:'app.component.html'

})
export class AppComponent implements OnInit//error here
{
ngOninit()
{
registerForm = new FormGroup({//error
first_name: new FormControl(),
last_name: new FormControl(),
phone: new FormControl(),
email: new FormControl(),
address: new FormGroup({
street: new FormControl(),
zip: new FormControl(),
city: new FormControl()
})
});
}
}

 
Answers (1)