# `FormController` (type in module `ng` )

Improve this doc

## Description

`FormController` keeps track of all its controls and nested forms as well as state of them, such as being valid/invalid or dirty/pristine.

Each `form` directive creates an instance of `FormController`.

## Methods

- ### $setPristine()

  Sets the form to its pristine state.

  This method can be called to remove the 'ng-dirty' class and set the form to its pristine state (ng-pristine class). This method will also propagate to all the controls contained in this form.

  Setting a form back to a pristine state is often useful when we want to 'reuse' a form after saving or resetting it.

## Properties

- ### $pristine

  True if user has not interacted with the form yet.

- ### $dirty

  True if user has already interacted with the form.

- ### $valid

  True if all of the containing forms and controls are valid.

- ### $invalid

  True if at least one containing control or form is invalid.

- ### $error

  Is an object hash, containing references to all invalid controls or forms, where:

  - keys are validation tokens (error names) — such as `required`, `url` or `email`),
  - values are arrays of controls or forms that are invalid with given error.