I am trying to populate programatically 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;
}
Non-working fiddle @ http://jsfiddle.net/VSph2/52/ The string is copied when I start my view, but the two values do not update eachother.
Basicallyk I'd like to bind to an object specified by reference or by name e.g "Query.Keywords" and have the scope evaluate this at runtime -- but I am not having much luck.
As you can see in the fiddle, my values do not stay synchronized.