Plunker.
In this plunter, I supported +and ++.
+to increase parent rows and ++to increment child rows.
Here it ++increases correctly. and "+" also increase correctly, if I click on it ++, it will add one child line for the parent.
then, if I click the button +, it should add another child row for the parent. but he adds another main line.
Here I got a line with this keyword in html. How can I get the parent of the child string that we clicked on.
ng-click="newSubItem(this)"
controller: -
$scope.newSubItem = function(scope) {
var nodeData = scope.$modelValue;
nodeData.items.push({
id: nodeData.id * 10 + nodeData.items.length,
rowId: nodeData.rowId + '.' + (nodeData.items.length + 1),
items: []
});
};
[] array.so .
, .