matth3o matth3o - 2 months ago 18
Dart Question

dart angular2 - two-ways binding in component

Is there a way to bind a field in a component as input and output ?

i.e.

<my-component [(innerComponentField)]="outerComponentField"></my-component>


Thanks for your help.

Answer

For [] the component needs a matching @Input() For () it needs a matching @Output().

There is no way to do both with just an @Input()

The combination [(innerComponentFields)] requires

@Input() dynamic innerComponentField;
@Output() EventEmitter innerComponentFieldChange = new EventEmitter();