TrevorGoodchild
TrevorGoodchild

Reputation: 1060

Angular 6 - Does it make a difference where you put the [formGroup]="form"

Working in Angular 6 and I'm seeing some pages where we have:

<div [formGroup]="form">

and others where it is:

<form [formGroup]="form">

Does it make any difference where the formGroup directive is placed?

Upvotes: 0

Views: 33

Answers (1)

Akber Iqbal
Akber Iqbal

Reputation: 15041

For the directive FormGroup, it doesn't really matter, you can use a reactive form with either of these.

But if you intend to use ngSubmit, you'd have to use <form [formGroup]="form"> because it wouldn't work with <div [formGroup]="form">

Upvotes: 1

Related Questions