title: Angularjs, Creating Array from Object and Error: $rootScope:infdig
body: <p>My aim is to create an arrays from object(as table rows) but I get the $rootScope:infdig error.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>$scope.rows = {
  "TableName": "TestTable",
  "Rows": [{
      "Name": "Name1",
      "RowCells": [{
          "Y": 2001,
          "M": 164
      }, {
          "Y": 2002,
          "M": 178
      }, {
          "Y": 2003,
          "M": 188
      }, {
          "Y": 2007,
          "M": 295
      }, {
          "Y": 2008,
          "M": 316
      }, {
          "Y": 2009,
          "M": 328
      }]
  }],
  "Rows": [{
      "Name": "Name2",
      "RowCells": [{
          "Y": 2001,
          "M": 164
      }, {
          "Y": 2002,
          "M": 178
      }, {
          "Y": 2003,
          "M": 188
      }, {
          "Y": 2007,
          "M": 295
      }, {
          "Y": 2008,
          "M": 316
      }, {
          "Y": 2009,
          "M": 328
      }]
  }],
  "Rows": [{
      "Name": "Name3",
      "RowCells": [{
          "Y": 2001,
          "M": 164
      }, {
          "Y": 2002,
          "M": 178
      }, {
          "Y": 2003,
          "M": 188
      }, {
          "Y": 2007,
          "M": 295
      }, {
          "Y": 2008,
          "M": 316
      }, {
          "Y": 2009,
          "M": 328
      }]
  }]
  }
  
   $scope.rowCells = function () {
                  var tableRowCollection = [];
  
                  angular.forEach($scope.rows, function (item) {
                      var tableRow = [];
                      tableRow.push(item.Name);
                      angular.forEach(item.RowCells, function (i) {
                          tableRow.push(i.M);
                      });
                      tableRowCollection.push(tableRow);
                  });
                  return tableRowCollection ;
              };
  
   &lt;div data-ng-repeat="r in rowCells()"&gt;{{r}}&lt;/div&gt;
  </code></pre>
  
  <p>I have seen similar question <a href="https://stackoverflow.com/questions/26753014/angularjs-error-rootscopeinfdig">here</a> but that didn't help.
  what am I missing or where am I going wrong?</p>