matth3o
matth3o

Reputation: 3689

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.

Upvotes: 1

Views: 452

Answers (1)

G&#252;nter Z&#246;chbauer
G&#252;nter Z&#246;chbauer

Reputation: 657476

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();

Upvotes: 2

Related Questions