Object defined in scope:
$scope.products = [ { name: 'custom', category: { name:'custom', templateAttribute: [ {attribute: 'material'}, {attribute: 'soles'}, {attribute: 'size'} ] } } ];
HTML:
<table class="table" ng-repeat="attr in products.category.templateAttribute"> <tbody> <tr> <td> <input value="{{attr.attribute}}" /> </td> <td> <input placeholder="name" ng-model="product.attributes[attr.attribute].name" /> </td> <td rowspan="2"> <button type="button" ng-click="addItem(product.category.templateAttribute, attr)"> add </button> </td> </tr> </tbody> </table>
What I want output to look every attribute has input form
How it seems like it should work:
<table class="table" ng-repeat="attr in products.category.templateAttribute">
How to fix its?
$scope.products =
. If it was JSON then the property names would be strings. If it was JSON then the strings would be delimited by double quote characters. If it was JSON then it wouldn't be trailed by a semi-colon.