Rephrasing question for clarification purpose.
Plunkr
View:
<input type="text" ng-model="form['data']['sampleData']">
<input type="text" ng-model="form[bindingPrefix][bindingSuffix]">
<input type="text" ng-model="form[bindingValue]">
Controller:
$scope.form = {
data: {
sampleData: '123'
}
};
$scope.bindingValue = 'data.sampleData';
$scope.bindingPrefix = 'data';
$scope.bindingSuffix = 'sampleData';
Desired effect:
I would expect form[bindingValue]
to yield the effect as form[bindingPrefix][bindingSuffix]
without purposely separating bindingValue
to bindingPrefix
and bindingSuffix
as bindingValue could be a dynamic value such as data.sampleData.childData
, data.sampleData.childData.childChildData
in an array for ng-repeat the model.
P/S: bindingValue is something that pass from Server side and i have no control over it.
========================================================================== Might work from this plunkr over here. Ideally, the view should not be modified.Click here