@Input and other decorators and inheritance

Discussão em 'Angular' iniciado por Silencer, Fevereiro 5, 2025.

  1. Silencer

    Silencer Guest

    I don't really understand how object binding works, so if anyone could explain if I can use @Input() inside a base class, or better: decorators and inheritance. For example if each form should receive a customer I have a base class:

    export class AbstractCustomerForm{

    @Input() customer;
    ...
    }


    and then I extend this class in an actual component:

    export AwesomeCustomerForm extends AbstractCustomerForm implements OnInit{
    ngOnInit(){

    if(this.customer)
    doSomething();

    }
    }


    but this won't work, customer will never get set :(

    Continue reading...

Compartilhe esta Página