title: Handling variable JSON response in Angular template
body: <p>I'm trying to figure out how to handle dynamic JSON responses with a single angular template. Below are two examples of the same template, but different JSON responses (somewhat similar). I'm trying to figure out how to handle both (and quite possibly more) of these responses in the same template. <strong>Essentially how do I handle UNKNOWN levels in a json response?</strong></p>
  
  <p><a href="http://plnkr.co/edit/1H9AfwUYvcYVEBmBb0Ln?p=preview" rel="nofollow">http://plnkr.co/edit/1H9AfwUYvcYVEBmBb0Ln?p=preview</a></p>
  
  <pre><code>{"book": {
          "title": "Book Title",
          "chapters": [
              {
                  "title": "Chapter One",
                  "units": [
                      {
                          "title" : "Unit One",
                          "sections": [
                              {"title" : "Section One"},
                              {"title" : "Section Two"},
                              {"title" : "Section Three"}
                          ]
                      },
                      {"title" : "Unit Two"},
                      {"title" : "Unit Three"}
                  ]
              },
              {"title": "Chapter Two"},
              {"title": "Chapter Three"}
          ]
      }};
  </code></pre>
  
  <p><a href="http://plnkr.co/edit/8S6iCrF3A72MNEpKEhMu?p=preview" rel="nofollow">http://plnkr.co/edit/8S6iCrF3A72MNEpKEhMu?p=preview</a></p>
  
  <pre><code>{"book": {
          "title": "Book Title",
          "chapters": [
              {
                  "title": "Chapter One",
                  "sections": [
                              {"title" : "Section One"},
                              {"title" : "Section Two"},
                              {"title" : "Section Three"}
                          ]
              },
              {"title": "Chapter Two"},
              {"title": "Chapter Three"}
          ]
      }};
  </code></pre>
  
  <p>Template:</p>
  
  <pre><code>  &lt;div ng-repeat="item in book"&gt;
      {{item.title}}
      &lt;ul&gt;
            &lt;li ng-repeat="chapter in item.chapters"&gt;
              {{chapter.title}}
            &lt;ul&gt;
              &lt;li ng-repeat="unit in chapter.units"&gt;
                {{unit.title}}
                &lt;ul&gt;
                  &lt;li ng-repeat="section in unit.sections"&gt;
                    {{section.title}}
                  &lt;/li&gt;
                &lt;/ul&gt;
              &lt;/li&gt;
            &lt;/ul&gt;
          &lt;/li&gt;
          &lt;/ul&gt;
    &lt;/div&gt;
  </code></pre>