I have joined a new project and got the code to local. I just started using Angular.

The application is using Angular version 6. I am not sure which type forms are being used.

Is there any way I can find out?

In the following the examples, I thought 1st example was using Reactive forms because of "FormGroup" (Please correct me if I am wrong), and I am not sure about 2nd example.

Html File 1:

<form [formGroup]="loginForm" (ngSubmit)="Login(loginForm.value)" name="login-form" class="form">

ts file 1:

import { FormBuilder, FormGroup, Validators } from '@angular/forms';

public ngOnInit() {
this.loginForm = this.formBuilder.group({
  'username': [null, Validators.required],
  'password': [null, Validators.required],
  'rememberMe': false

Html File 2:

<form id="aForm" target="_blank" action="{{Url}}" method="post" #aForm>
   <input type="submit" (click)="aForm.submit()" value="submit" /> 

ts file 2:

Not mentioned anything about forms.

1 Answers

Francisco Santorelli On Best Solutions

Template driven Forms are in the Template, and Reactive Forms use the classes from Reactive Forms, that's the AbstractControl group.

A good way to look at it is: If you see [(ngModel)] in the Template, it's template driven. If you see formControls formGroups and formArrays, it is reactive.

In your case, the use of formBuilder means it is reactive