javascript - Angular Binding field to Dynamic model modifies all values in object -


so have code in view:

    <div class="form-group" ng-repeat="columnheader in form.table[fakeform.currentformindex].columns track $index">              <label for="">column <%$index%></label>              <div class="fg-line">                     <input type="text" class="form-control"                                  placeholder="column header <%index%>"                      ng-model="form['table'][fakeform.currentformindex]['columns'][$index].name"/>              </div>     </div> 

this targets 'current active' appended element. whenever uses this, modifies other appended elements same attributes each of elements has unique key assigned them.

look @ image here

then i'm pushing data set new key.

'columns':[{name:'column 1'}, {name:'column 2'}, {name:'column 3'}],             'rows':[                 {                     label:'row 1',                     columns:[                         {                             label:'row 1 column 1'                         },                         {                             label:'row 1 column 2'                         },                         {                             label:'row 1 column 3'                         }                     ]                 },                 {                     label:'row 2',                     columns:[                         {                             label:'row 2 column 1'                         },                         {                             label:'row 2 column 2'                         },                         {                             label:'row 2 column 3'                         }                     ]                 },                 {                     label:'row 3',                     columns:[                         {                             label:'row 3 column 1'                         },                         {                             label:'row 3 column 2'                         },                         {                             label:'row 3 column 3'                         }                     ]                 }             ] 

so example have 2 'table' key,

table:{ 0:.... 1:.... } 


Comments

Popular posts from this blog

php - How to display all orders for a single product showing the most recent first? Woocommerce -

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

angularjs - How restrict admin panel using in backend laravel and admin panel on angular? -