I am trying to program a list of inputs.
I have something like
<div ng-repeat="field in fields">
<input ng-model="field.Binding" />
</div>
var Query = {
Keywords: "Foo",
Title: "Bar"
}
var Fields = [{
Name: "Keywords",
Binding: Query.Keywords
}, {
Name: "Title",
Binding: Query.Title
}];
var myApp = angular.module('myApp', []);
function MyCtrl($scope) {
$scope.fields = Fields;
$scope.query = Query;
}
Broken fiddle @ http://jsfiddle.net/VSph2/52/
The string is copied when my view starts, but these two values do not update each other.
Basicallyk I would like to bind to the object specified by reference or by name, for example "Query.Keywords", and evaluate it at runtime - but I'm not very lucky.
As you can see in the fiddle, my values are not synchronized.
source
share