1. Release Candidate 2 is out!

After several weeks of hard work, the Angular team released a new release candidate with many new features, performance improvements and even more bug fixes. Read the changelog here.

2. Radio Buttons can now share FormControl instance

Using Radio Buttons became a whole lot easier thanks to the great @karaforthewin. It’s no longer needed to create the RadioButtonSate imperatively to manage radio buttons. All we need is:

<form #f="ngForm">
   <input type="radio" name="food" [(ngModel)]="food" value="chicken">
   <input type="radio" name="food" [(ngModel)]="food" value="fish">
</form>

      // { food: 'fish' }

Where as the component could look like this:

class MyComp {
   food = 'fish';
}

3. Validators can now be composed implicitly

Applying validators to form control just got a more intuitive. We don’t have explicitly compose multiple validators using Validators.compose() anymore. All we have to do is passing an array of validators to the form control, and Angular composes them automatically. Here’s what that looks like:

class MyComp {
   myForm = new FormGroup({
      firstName: new FormControl('Nancy', Validators.required),
      lastName: new FormControl('Drew', [Validators.required, Validators.minLength(3)])
   })
}

4. Easily switch between deprecated forms and the new forms API

With the release of RC2, a new forms API has been published as well. This is great because the older API had many flaws and bugs, plus it felt often flaky. In order to use the new forms API, all we have to do is to use some provider functions like this:

import {disableDeprecatedForms, provideForms} from '@angular/forms';

bootstrap(AppComponent, [
   disableDeprecatedForms(),
   provideForms()
])

5. Form API Changes

Here’s a summary of what APIs have changed:

  • ngControlName -> formControlName
  • ngFormControl -> formControl
  • ngControlGroup -> ngModelGroup/formGroupName
  • Control -> FormControl
  • ControlGroup -> FormGroup
  • ControlArray -> FormArray

If you want to learn more about why these changes have been been made, make sure to check out this design doc.