I have been utilizing ng-repeat
to connect form elements to the attributes of a custom object I've created. Here's an example:
$scope.myObject = {
'font-size': 10,
'text-outline-width': 2,
'border-color': 'black',
'border-width': 3,
'background-color': 'white',
'color': '#fff'
}
HTML:
<div ng-repeat='(key, prop) in myObject'>
<p>{{key}} : {{prop}}</p>
<input type='text' ng-model='myObject[key]'>
</div>
However, each time I attempt to input a value into the text box, it gets deselected and I must click on it again to continue typing.
Is there an alternative method for achieving this two-way binding with an object that allows for seamless typing?
Check out the JSFiddle here: http://jsfiddle.net/AQCdv/1/