title: AngularJS: fn is not a function
body: <p>After calling a function <code>results</code> I have an error: <code>TypeError: fn is not a function</code>. Before calling it, everything works fine, first <code>$http.get</code> gets good data. Any ideas how to fix it?</p>
  
  <pre><code>var app = angular.module("cowork", []);
  
  app.config(function($interpolateProvider) {
    $interpolateProvider.startSymbol('{[{');
    $interpolateProvider.endSymbol('}]}');
  });
  
  app.controller("SearchDeskCtrl", ['$scope', '$http', function ($scope, $http) {
    $scope.search = false;
    $scope.city;
  
    $http.get('/cowork/desks').success(function(data, status, headers, config) {
      return $scope.results = data;
  })
  
  
  
  $scope.results = function(search) {
    if (search){
      $http.get('/cowork/desks_city', {city: $scope.city}).success(function(data, status, headers, config) {
          search=false;
          return data;
      })}    
    }
  
  }])
  </code></pre>
  
  <p><strong>EDIT:</strong>
  My point in whole thing is to take results from first <code>$http.get</code> and then, after calling function, overwrite this data. Moreover, I need to pass one string parameter in second <code>$http.get</code> call (in function) to pass <code>city</code> parameter and then receive it in <code>request</code> (from Django side).</p>