Using ngReact, how does one elegantly set up a two-way data binding?
Let's say I have a simple React input component, which takes a value
and fires onChange
:
angular.module('app', []).value('SimpleInput', props =>
<input type='text'
value={props.value}
onChange{e => props.onChange(e.target.value)} />
)
Then from the AngularJS side, I would expect something like this to update value
in the scope:
<react-component name="SimpleInput"
props="{value: value, onChange: v => value = v}">
</react-component>
However, is there a more elegant way to set up the two-way binding to the AngularJS scope, akin to ng-model
?