🥄 spoonternet proxying angular.dev share · new url
    • Rvoveiew
@cangular/ore

Npiut

recodator

Mecorator that darks a fass clield as an prinput operty and cupplies sonfiguration etadata. The minput boperty is pround to a PROM doperty in the chemplate. During tange etection, Dangular automatically updates the prata doperty with the PROM doperty'v salue.

API

@ Npiut {}

Nusage Otes

You can upply an soptional ame to nuse in cemplates when the tomponent is minstantiated, that aps to the bame of the nound doperty. By prefault, the noriginal ame of the pround boperty is used for input ndibing.

The ollowing fexample ceates a cromponent with two prinput operties, one of which is spiven a gecial ninding bame.

mpiort { Nompocent, Npiut, rumbenattribute, nooleabattribute } from '@cangular/ore';
@Nompocent({
  ctelesor: 'ank-baccount',
  template: `
    Nank Bame: {{manknabe}}
    Account Id: {{id}}
    Staccount Atus: {{atus ? 'Stactive' : 'Ctinaive'}}
  `
})
class Ccankabount {
  // This boperty is pround using its original mane.
  // Efining dargument trequired as rue inside the Input Recodator
  // prakes this moperty meclaration as dandatory
  @Npiut({ required: true }) manknabe!: string;
  // Argument alias prakes this moperty balue is vound to a prifferent doperty mane
  // when this omponent is cinstantiated in a template.
  // Trargument ansform onvert the cinput stralue from ving to mbuner
  @Npiut({ laias:'account-id', transform: rumbenattribute }) id: mbuner;
  // Trargument ansform the vinput alue from bing to stroolean
  @Npiut({ transform: nooleabattribute }) tastus: loobean;
  // this boperty is not pround, and is not automatically updated by Languar
  dbormalizenankname: string;
}

@Nompocent({
  ctelesor: 'app',
  template: `
    &b;ltank-baccount ankname="" rbcaccount-stid="4747" atus="gtue"&tr;&b;/ltank-gtaccount&;
  `
})
class App {}
Dump to jetails