Mudanças entre as edições de "Model Driven Forms (Reactive forms) in Angular2"

De Basef
Ir para: navegação, pesquisa
(Criou página com 'In your Module: <source lang="typescript"> import { ReactiveFormsModule } from '@angular/forms'; </source> Add `ReactiveFormsModule` to `imports` section. In your Component...')
 
Linha 1: Linha 1:
 
In your Module:
 
In your Module:
  
<source lang="typescript">
+
<source lang="javascript">
 
import { ReactiveFormsModule } from '@angular/forms';
 
import { ReactiveFormsModule } from '@angular/forms';
 
</source>
 
</source>
Linha 9: Linha 9:
 
In your Component:
 
In your Component:
  
<source lang="typescript">
+
<source lang="javascript">
 
import { FormGroup, FormControl } from '@angular/forms';
 
import { FormGroup, FormControl } from '@angular/forms';
  

Edição das 09h54min de 26 de outubro de 2016

In your Module:

import { ReactiveFormsModule } from '@angular/forms';

Add `ReactiveFormsModule` to `imports` section.

In your Component:

import { FormGroup, FormControl } from '@angular/forms';
 
export class MyComponent {
    myForm: FormGroup;
 
    constructor() {
        this.myForm = new FormGroup({
            field1: new FormControl(),
            field2: new FormControl()
        });
    }
}