Sujeet Raman

Sujeet Raman

  • 864
  • 927
  • 352.9k

Getting error when creating property in Angular 2

Apr 11 2017 3:11 AM

 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)