title: Angular.js autocomplete with $http.get TypeError: Cannot read property 'success' of undefined
body: <p>With this code i always get <strong>TypeError: Cannot read property 'success' of undefined</strong>.
  I've tried also with .then instead of .success but i get the same error. 
  After plus than ten hours of googling i'm a little bit desperate...</p>
  
  <p>Html:</p>
  
  <pre><code>&lt;div ng-controller="search_interest" layout="column"&gt;
      &lt;md-chips ng-model="ctrl.selectedVegetables" md-autocomplete-snap md-require-match&gt;
          &lt;md-autocomplete
              md-selected-item="selectedItem"
              md-search-text="searchText"
              md-items="item in getInterest(searchText)"
              md-item-text="item.name"
              placeholder="Search for a vegetable"&gt;
              &lt;span md-highlight-text="searchText"&gt;{{item.name}} :: {{item.type}}&lt;/span&gt;
          &lt;/md-autocomplete&gt;
          &lt;md-chip-template&gt;
              &lt;span&gt;
              &lt;strong&gt;{{$chip.name}}&lt;/strong&gt;
              &lt;em&gt;({{$chip.type}})&lt;/em&gt;
              &lt;/span&gt;
          &lt;/md-chip-template&gt;
      &lt;/md-chips&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>And the js:</p>
  
  <pre><code>var app = angular.module('autocomplete_app', ['ngMaterial']);
  
  app.controller('search_interest',
      function($scope, $http){
          $scope.searchText = '';
          $scope.selectedItem = undefined;
          function getInterest($scope){
              $http.get("someurl.php?query=" + $scope.searchText)
                  .success(function(data){
                      $scope.interest = data;
                      console.log('data', JSON.stringify(data));
                  });
          };
      });
  </code></pre>