title: Conditional ng-model binding in angularjs
body: <p>I have a model which is an array that needs to handle complex and simple elements :</p>
  
  <pre><code>{
      "object" :[
                 "element1.html",
                 "element2.html",
                 {
                     "url:"element3.html",
                     "title" : "Title 3"
                 },
                 "element4.html",
                 "element5.html"
              ]
  }
  </code></pre>
  
  <p>Is there some way to make a select which can handle both simple and complex elements in angularjs (showing url from the complexs)?</p>
  
  <p><strong>Approach 1</strong></p>
  
  <p>I mean some like that:  </p>
  
  <pre><code>ng-model="(object[$index].url ? object[$index].url : object[$index])"
  </code></pre>
  
  <p><strong>Approach 2</strong></p>
  
  <p>Make a normalized object that will have the complex structure for each object with empty arrays and a file type indicating whether is simple or complex.</p>
  
  <p>Could I make some magic with angular to avoid the second approach?</p>
  
  <p>Thanks!</p>