title: How to show parent and childrenwith ng-options
body: <p>I want to create ng-options from with I can select elements from parent object and children objects.
  My json looks like this:</p>
  
  <pre><code>{
  "errors":[
  
  ],
  "headquarters":{
    "id":1,
    "name":"headquarter name",
    "departments":[
       {
          "id":2,
          "name":"department A name",
          "divisions":[
             {
                "id":6,
                "name":"Division A name"
             },
             {
                "id":7,
                "name":"Division B name"
             },
             {
                "id":8,
                "name":"Division C name"
             }
          ]
       },
       {
          "id":3,
          "name":"department B name",
          "divisions":[
             {
                "id":11,
                "name":"Division E name"
             },
             {
                "id":12,
                "name":"Division F name"
             },
             {
                "id":13,
                "name":"Division G name"
             }
          ]
       }
    ]
   }
   }
  </code></pre>
  
  <p>From this Json I want to pick headquarters or department and then if department and not headquarters is selected use picked id to select division. I tried to do something like this:</p>
  
  <pre><code>      element.id as element.name for element in user.structure.headquarters &amp;&amp; user.structure.headquarters.departments
  </code></pre>
  
  <p>But it's not working.</p>
  
  <p>Is this possible to do?</p>
  
  <p>Or is there any other way to do it?</p>
  
  <p>There is always only one headquarters in the JSON.</p>