nested ng-repeat

update nested ng-repeat

by Osama Qassar

HTML

<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.5/angular.min.js"></script>
<div ng-app="myApp" ng-controller="Ctrl">
  <table>
    <tr ng-repeat="Row in Mi">
      <td ng-repeat="I in Row track by $index">
        {{I}}
      </td>
    </tr>
  </table>
  <button ng-click="aaa()">aaa</button>
  {{Mi}}

<hr>
<input type="text" ng-model="add">
<div ng-repeat="p in pos">
    {{p}}: 
    <span ng-repeat="c in cont" ng-show="c.pos==p">
     {{c.txt}}
    </span>
</div>
  <button ng-click="bbb()">bbb</button>
</div>
<script>
var myApp = angular.module('myApp', []);

function Ctrl($scope) {
$scope.Mi = [
    [1, 2, 3],
    [4, 5, 6],
    [7, 8, 9]
];
$scope.aaa = function(){
    $scope.Mi = [
      [1, 1, 1],
      [4, 5, 6],
      [7, 8, 9]
    ];
}
  
//------------------------------------------
$scope.pos = ['a','b','c','d','e','f','g'];
$scope.cont = [
      {pos:'a', txt:'a content'},
      {pos:'f', txt:'f content'},
      {pos:'c', txt:'c content'}
	];
$scope.bbb = function(){
	var v = $scope.add;
	$scope.cont.push( {pos:v, txt: v+' content'} )
}



}

myApp.controller('Ctrl', Ctrl);

</script>