title: Angular almighty autocomplete
body: <p>Im trying to alter the <a href="https://github.com/JustGoscha/allmighty-autocomplete" rel="noreferrer">almighty autocomplete</a> to accept an array of objects instead of just an array of strings. But sadly, I am at a standstill.</p>
  
  <p>Here I want an array to contain objects instead of strings in the app.js</p>
  
  <pre><code>MovieRetriever.getmovies = function(i) {
  var moviedata = $q.defer();
  var movies;
  
  var moreMovies = [{id: "0", name: "someMovie"}, {id: "1", name: "anotherMovie"}, {id: "2", name: "aMovie"}];
  
  // var moreMovies = ["The Wolverine", "The Smurfs 2", "The Mortal Instruments: City of Bones"]
  
  if(i &amp;&amp; i.indexOf('T')!=-1)
    movies=moreMovies;
  else
    movies=moreMovies;
  
  $timeout(function(){
    moviedata.resolve(movies);
  },1000);
  
  return moviedata.promise
  </code></pre>
  
  <p>But when I do that, I get punished with errors like</p>
  
  <p>Error: [$sce:itype] <a href="http://errors.angularjs.org/1.2.12/" rel="noreferrer">http://errors.angularjs.org/1.2.12/</a>$sce/itype?p0=html</p>
  
  <p>Which I suspect origins from this area in the autocomplete.js</p>
  
  <pre><code>template: '\
      &lt;div class="autocomplete {{ attrs.class }}" id="{{ attrs.id }}"&gt;\
        &lt;input\
          type="text"\
          ng-model="searchParam"\
          placeholder="{{ attrs.placeholder }}"\
          class="{{ attrs.inputclass }}"\
          id="{{ attrs.inputid }}"/&gt;\
        &lt;ul ng-show="completing"&gt;\
          &lt;li\
            suggestion\
            ng-repeat="suggestion in suggestions | filter:searchFilter | orderBy:\'toString()\' track by $index"\
            index="{{ $index }}"\
            val="{{ suggestion }}"\
            ng-class="{ active: ($index === selectedIndex) }"\
            ng-click="select(suggestion)"\
            ng-bind-html="suggestion | highlight:searchParam"&gt;&lt;/li&gt;\
        &lt;/ul&gt;\
      &lt;/div&gt;'
  </code></pre>
  
  <p>And here</p>
  
  <pre><code>app.filter('highlight', ['$sce', function ($sce) {
  </code></pre>
  
  <p>I meant to paste more code here, but the editor plays tricks on me. And this being my first question, I will have to leave it at that.</p>
  
  <p>Please follow the link in the top for full code example, and see if you can help me</p>