Cookies concent notice

This site uses cookies from Google to deliver its services and to analyze traffic.
Learn more
Skip to main content
This site is no longer updated.Head to Angular.devHome
/

This is the archived documentation for Angular v17. Please visit angular.dev to see this page for the current version of Angular.

InputOptions

      
      interface InputOptions<T, TransformT> {
  alias?: string
  transform?: (v: TransformT) => T
}
    

Properties

Property Description
alias?: string

Optional public name for the input. By default, the class field name is used.

transform?: (v: TransformT) => T

Optional transform that runs whenever a new value is bound. Can be used to transform the input value before the input is updated.

The transform function can widen the type of the input. For example, consider an input for disabled. In practice, as the component author, you want to only deal with a boolean, but users may want to bind a string if they just use the attribute form to bind to the input via <my-dir input>. A transform can then handle such string values and convert them to boolean. See: booleanAttribute.