GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Docs
  • Tutorials
  • Playground
  • Reference
  • code
  • input.required()
  • Signal
  • Accepting data with input properties
  • InputSignal
  • InputOptionsWithoutTransform
  • InputOptionsWithTransform
  • InputSignalWithTransform

This view

  • Original page
  • New address

GeezerVison is showing angular.dev — input • Angular

API

    
      
    
    

Initializes an input of type T with an initial value of undefined. Angular will implicitly use undefined as initial value.

@returnsInputSignal<T | undefined>

Declares an input of type T with an explicit initial value.

@paraminitialValueT
@paramoptsInputOptionsWithoutTransform<T> | undefined
@returnsInputSignal<T>

Declares an input of type T|undefined without an initial value, but with input options

@paraminitialValueundefined
@paramoptsInputOptionsWithoutTransform<T>
@returnsInputSignal<T | undefined>

Declares an input of type T with an initial value and a transform function.

The input accepts values of type TransformT and the given transform function will transform the value to type T.

@paraminitialValueT
@paramoptsInputOptionsWithTransform<T, TransformT>
@returnsInputSignalWithTransform<T, TransformT>

Declares an input of type T|undefined without an initial value and with a transform function.

The input accepts values of type TransformT and the given transform function will transform the value to type T|undefined.

@paraminitialValueundefined
@paramoptsInputOptionsWithTransform<T | undefined, TransformT>
@returnsInputSignalWithTransform<T | undefined, TransformT>

Declares an input of type T with an initial value and a transform function that accepts values of type unknown.

@paraminitialValueT
@paramoptsInputOptionsWithTransform<T, unknown>
@returnsInputSignalWithTransform<T, unknown>

Declares an input of type T|undefined without an initial value and with a transform function that accepts values of type unknown.

@paraminitialValueundefined
@paramoptsInputOptionsWithTransform<T | undefined, unknown>
@returnsInputSignalWithTransform<T | undefined, unknown>

Declares a required input of type T.

@paramoptsInputOptionsWithoutTransform<T> | undefined
@returnsInputSignal<T>

Declares a required input of type T with a transform function.

The input accepts values of type TransformT and the given transform function will transform the value to type T.

@paramoptsInputOptionsWithTransform<T, TransformT>
@returnsInputSignalWithTransform<T, TransformT>

Usage Notes

To use signal-based inputs, import input from @angular/core.

import {input} from '@angular/core';

Inside your component, introduce a new class member and initialize it with a call to input or input.required.

@Component({
  ...
})
export class UserProfileComponent {
  firstName = input<string>();             // Signal<string|undefined>
  lastName  = input.required<string>();    // Signal<string>
  age       = input(0)                     // Signal<number>
}

Inside your component template, you can display values of the inputs by calling the signal.

<span>{{firstName()}}</span>
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.