I'm trying to add new rows.cell element but push syntax is not clear for me. If i specify push([]) i see on page changes. However instead of new empty div created i see new with square brackets "[]".
Pleas advise how to add new empty element to each rows.cell array?
html code:
<div class="row" ng-repeat="row in rows">
<div class="cell" ng-repeat="cell in row.cell">{{ cell }}</div>
</div>
</div>
controller code:
angular.module("myapp", [])
.controller("infoTable", function($scope) {
$scope.rows = [
{"id": 10, "cell": ['a','b','c']},
{"id": 11, "cell": ['a','b','c']}
];
$scope.addColumn = function (){
$scope.rows.forEach(function($row){
$row.cell.push([]);
});
}
});
Solved: "track by $index" added to ng-repeat="cell in row.cell" And now new array element can be added using
$row.cell.push('');