Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.0/angular.min.js"></script>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>
  
  <div ng-app="myApp" ng-controller="MyCtrl">
    <div ng-repeat="comment in comments" ng-include="'comment.html'"></div>
  <script type="text/ng-template"  id="comment.html">
    <div>
      <p>{{comment.author.name}}: {{comment.text}}</p>
      <div class="reply" ng-repeat="comment in comment.replies" ng-include="'comment.html'"></div>
    </div>
  </script>
  </div>
  </body>
</html>
 
angular.module('myApp', [])
.controller('MyCtrl', function($scope) {
  $scope.comments = [
    {
      id: 1,
      text: 'Hello World!',
      author: {
        id: 1,
        name: 'Jorge'
      },
      replies: [
        {
          id: 2,
          text: 'Hey, Jorge!',
          author: {
            id: 2,
            name: 'World'
          },
          replies: [
            {
              id: 3,
              text: 'Woah!',
              author: {
                id: 1,
                name: 'Jorge'
              }
            }
          ]
        }
      ]
    }
  ];
})
;
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers