1

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.

1 Answer 1

2

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();
Sign up to request clarification or add additional context in comments.

3 Comments

Thanks for your help. Do you have an example of code doing that? I didn't find a lot of information in the official documentation.
Oups my bad. It works but I have to call myEventEmitter.emit() each time my value changes and I have to implement a method in my outer component to update my field. Thanks for your help.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.