formly-js / angular-formly

JavaScript powered forms for AngularJS
http://docs.angular-formly.com
MIT License
2.23k stars 406 forks source link

Model is not updated when input is inside angular component #718

Closed ivanvoznyakovsky closed 7 years ago

ivanvoznyakovsky commented 7 years ago

When a custom type is wrapping an input which is an angular component, changes made to passed in value inside that component are not propagated back to the formly model.

This does work as expected when input is inside a directive though. I assume it's related with two-way vs one-way data binding.

Is this a bug or do I need some extra logic to propagate changes back from a component?

Here's a jsbin.

smajl commented 7 years ago

You are right, it is related to one-way and two-way binding. You are using one-way binding in your component, so things are going one way, right? Just use =. Nobody said you have to use < only in components...

ivanvoznyakovsky commented 7 years ago

@smajl you're right. I was trying to follow angular's docs saying Inputs should be using < and @ bindings., but this does not work in this case. closing as not related to formly