angular/angular.js — pull request #5037 by slobo (2013-11-19 20:25:24+00:00)
Title: Independent sub FormController via `not-required` attribute

This PR implements ability to prevent FormController from linking to parentForm if `not-required` attr is defined on the `[ng-]form` element.

It is useful for scenario like below, where `aux` subform can be independently validated without invalidating `parent` form. Without this patch (and `not-required` on the subforms), master "Save" button is disabled when aux input fields are not filled out. Idea is to use them only temporarily before adding to master model and then clears them out.

Alternatively, if subform inputs are not marked as required, then subform "Add" buttons will always be enabled. Options are either user or programmer un-friendly.

(The only workaround I found is to use `ng-if` on the subform to add it to DOM only when requested, but often we need subforms visible all the time, and we can't place them elsewhere in the DOM.)

```html

Save

Selected colours:

{{colour.name}}

Add

Selected fabrics:

{{fabric.name}}

Add

...
```