Open links in new tab
  1. In Angular, @Input() allows a parent component to pass data into a child component property. This is essential for building reusable and dynamic components.

    Example – Passing Data from Parent to Child:

    // child.component.ts
    import { Component, Input } from '@angular/core';

    @Component({
    selector: 'app-child',
    template: `<p>Item: {{ item }}</p>`
    })
    export class ChildComponent {
    @Input() item: string = '';
    }

    // parent.component.ts
    @Component({
    selector: 'app-parent',
    template: `<app-child [item]="currentItem"></app-child>`
    })
    export class ParentComponent {
    currentItem = 'Television';
    }
    Copied!

    Here, currentItem in the parent is bound to item in the child.

    Required Inputs You can enforce that an input must be provided:

    @Input({ required: true }) item!: string;
    Copied!

    If omitted in the parent template, Angular throws a compile-time error.

    Using Aliases Change the property name used in templates without altering the class property:

    @Input({ alias: 'sliderValue' }) value = 0;
    // Usage in parent:
    <custom-slider [sliderValue]="50"></custom-slider>
    Copied!
  1. Sharing data between child and parent directives and components

    • The @Input()decorator in a child component or directive signifies that the property can receive its value from its parent component. To use @Input(), you must configure the parent and child.
    See more on angular.io
  2. Angular @Input: Complete Guide

    Mar 8, 2025 · Learn how to use the Angular @Input decorator with all its many extra options, including the super-useful input transforms mechanism.

  3. Input Decorator In Angular - GeeksforGeeks

    Jul 23, 2025 · The @Input decorator is important for communication between components ensuring that the child component can receive data from its parent and act accordingly. In this article, we will …

  4. input () Function in Angular With Examples | Tech Tutorials

    Nov 25, 2025 · In this tutorial we'll see what is input () function in Angular and how to use it for facilitating parent-child communication. Angular input () function was released in version 17 as a part …

  5. What is @Input () used for in Angular? - Stack Overflow

    In this example, hero-detail is a child component, it's meant to be inserted into a parent component which will have the 'hero' data, and that 'hero' data will be …

  6. People also ask
  7. Exploring Angular 17+ Functional Inputs API: input(), …

    May 10, 2025 · Angular 17 introduced a new input() function as part of the Signal-based API, offering a declarative and reactive alternative to the traditional …

  8. Angular @Input and @Output - ConcretePage.com

    Feb 11, 2024 · Here on this page we will provide a complete example for @Input and @Output decorators. We are creating a parent component and two child …

  9. Input • Angular

    By default, the original name of the bound property is used for input binding. The following example creates a component with two input properties, one of which …

  10. How to Use @Input () in Angular - Delft Stack

    Feb 2, 2024 · Below is a list of valid types for an input field: To use @Input(), you need to add it as a directive on the desired HTML element. @Input() is used to …