I have encountered similar questions in the past and have tried the solutions provided, but my issue has a unique twist.
Imagine I have an array of objects like this in my controller:
$scope.objArray = [
{
id:1,
name:"placeholder1"
},
{
id:2,
name:"placeholder2"
}
];
Based on this array, I am dynamically generating a form like this:
<div ng-repeat="field in fields">
{{field.field_name}} </br>
<input type="text" ng-model="field.field_name"><br>
</div>
In this form, I want the ng-model
value to be set as placeholder1
and placeholder2
, not as a JavaScript variable like field.field_name
. This is because my targets are sourced from another location containing HTML code like the following:
<p>this is sample html {{placeholder1}}. again sample html {{placeholder2}} </p>
I do not have access to those JS variables here. So far, I have not found a solution that caters to my specific requirements.
Here is a link to the Plunker showcasing this issue: http://plnkr.co/edit/ttaq0l3PDRu4piwSluUX?p=preview