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 :(
update
Inheritance is properly supported since 2.3.0-rc.0
original
Decorators are not inherited. They need to be applied to the class used as component directly. Decorators on subclasses are ignored. I have seen it mentioned that @Input()
or @Output()
are working if only the super class has them and the sub-class has none.