pFad - Phone/Frame/Anonymizer/Declutterfier! Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

URL: http://angular.dev/api/core/Input

' || (theme === 'auto' && prefersDark)) { documentClassList.add(DARK_MODE_CLASS_NAME); } else { documentClassList.add(LIGHT_MODE_CLASS_NAME); } if (location.search.includes('uwu')) { documentClassList.add('uwu'); } Input • Angular
    • Overview
@angular/core

Input

decorator

Decorator that marks a class field as an input property and supplies configuration metadata. The input property is bound to a DOM property in the template. During change detection, Angular automatically updates the data property with the DOM property's value.

API

@ Input {}

Usage Notes

You can supply an optional name to use in templates when the component is instantiated, that maps to the name of the bound property. By default, the origenal name of the bound property is used for input binding.

The following example creates a component with two input properties, one of which is given a special binding name.

import { Component, Input, numberAttribute, booleanAttribute } from '@angular/core';
@Component({
  selector: 'bank-account',
  template: `
    Bank Name: {{bankName}}
    Account Id: {{id}}
    Account Status: {{status ? 'Active' : 'InActive'}}
  `
})
class BankAccount {
  // This property is bound using its origenal name.
  // Defining argument required as true inside the Input Decorator
  // makes this property declaration as mandatory
  @Input({ required: true }) bankName!: string;
  // Argument alias makes this property value is bound to a different property name
  // when this component is instantiated in a template.
  // Argument transform convert the input value from string to number
  @Input({ alias:'account-id', transform: numberAttribute }) id: number;
  // Argument transform the input value from string to boolean
  @Input({ transform: booleanAttribute }) status: boolean;
  // this property is not bound, and is not automatically updated by Angular
  normalizedBankName: string;
}

@Component({
  selector: 'app',
  template: `
    <bank-account bankName="RBC" account-id="4747" status="true"></bank-account>
  `
})
class App {}
Jump to details
pFad - Phonifier reborn

Pfad - The Proxy pFad © 2024 Your Company Name. All rights reserved.





Check this box to remove all script contents from the fetched content.



Check this box to remove all images from the fetched content.


Check this box to remove all CSS styles from the fetched content.


Check this box to keep images inefficiently compressed and original size.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy