formischField

Structural directive that creates a typed field store for a path and exposes it as the implicit context of the template. It is exported as the FormischField class.

<input
  *formischField="['email'] of form; let field"
  [formischControl]="field"
/>

Generics

Inputs

Context

Explanation

The *formischField directive is a thin wrapper around injectField that lets you create a field directly in your template. The path is the expression before the of keyword, and the form store follows it. Passing the form explicitly this way is what allows the context guard to infer the type of the field's value.

The field store is exposed as the implicit context, so let field binds it. Bind it to a native element with the [formischControl] directive. When one field spans multiple elements — a label, the input and an error message — use an <ng-container> as the host of the directive.

Because the directive declares an ngTemplateContextGuard, an invalid path is a compile error in your template as soon as strictTemplates is enabled in the angularCompilerOptions of your tsconfig.json.

To import the directive, add the FormischField class to the imports array of your component.

The following APIs can be combined with formischField.

Functions

Directives

Methods

Contributors

Thanks to all the contributors who helped make this page better!

  • GitHub profile picture of @fabian-hiller

Partners

Thanks to our partners who support the project ideally and financially.

Sponsors

Thanks to our GitHub sponsors who support the project financially.

  • GitHub profile picture of @vasilii-kovalev
  • GitHub profile picture of @UpwayShop
  • GitHub profile picture of @ruiaraujo012
  • GitHub profile picture of @hyunbinseo
  • GitHub profile picture of @nickytonline
  • GitHub profile picture of @kibertoad
  • GitHub profile picture of @caegdeveloper
  • GitHub profile picture of @Thanaen
  • GitHub profile picture of @bmoyroud
  • GitHub profile picture of @ysknsid25
  • GitHub profile picture of @dslatkin