How to pass an ng-model to a controller function which calls a GET request to the nodeJS server?

Here's what I'm trying to do:

  1. Pass a string from a text input with an ng-model bound to it
  2. to a function in the controller which
  3. calls a GET request in the service which
  4. gets returned by the node server

Below is what I've tried so far, which has given me the following error:

Uncaught object angular.js:78

Main.html (1):

<div class="input-group input-group-lg">
    <input ng-model="businessName" type="text" class="form-control" placeholder="Business Name">
</div>

google.js (2):

var findGPlace2 = function() {
  GoogleService.findPlace2($scope.businessName).then(function(data) {
    $scope.gPlace2 = data;
  });
}
findGPlace2();

google-service.js (3):

this.findPlace2 = function(biz){
    var deferred = $q.defer();
    var obj = {
      business: biz
    };
    $http(
      {
        method: 'GET', 
        url: 'http://localhost:12200/find-google-place-2', 
        data: biz
      }).success(function(data) {
        deferred.resolve(data);
      }).error(function(err) {
      deferred.reject(err);
    });
    return deferred.promise;
  };

server.js (4):

//find google place 2
app.get('/find-google-place-2', function(req, res) {
  request('https://maps.googleapis.com/maps/api/place/textsearch/json?query=' + req.data.biz + '&key=AIzaSyBvakIQ68QV2', function (error, response, body) {
  if (!error && response.statusCode == 200) {
    res.send(body);
  }
})
});

This is a very difficult problem to debug since the error isn't giving me a line in my code. Any help would be greatly appreciated.

==================================================

==================================================

UPDATE: I removed ng-autocomplete from the dependencies, and the Uncaught object error is gone and my angular code is rendering now, but this error came up:

GET http://localhost:12200/find-google-place-2 500 (Internal Server Error) angular.js:8380
    (anonymous function) angular.js:8380
    sendReq angular.js:8180
    $http.serverRequest angular.js:7921

I'm sure it has to do with how I'm passing my req data (the string from the text input), here is the function:

this.findPlace2 = function(biz){
    var deferred = $q.defer();
    var obj = {
      business: biz
    };
    $http(
      {
        method: 'GET', 
        url: 'http://localhost:12200/find-google-place-2', 
        data: biz
      }).success(function(data) {
        deferred.resolve(data);
      }).error(function(err) {
      deferred.reject(err);
    });
    return deferred.promise;
  };

Here's where it's actually running in my server.js file:

app.get('/find-google-place-2', function(req, res) {
  request('https://maps.googleapis.com/maps/api/place/textsearch/json?query=' + req.data.biz + '&key=AIzaSyBvakIQ68QV2', function (error, response, body) {
  if (!error && response.statusCode == 200) {
    //console.log(body) 
    res.send(body);
  }
})
});

There isn't really enough to go on with what you've given me, but here are some suggestions on how to go about debugging:

  1. Is this problem happening before or after the http request? Use a console.log on your server to find out.
  2. Use chrome dev tools or firebug and set breakpoints in your code to see how far you go.

This is almost definitely (my guess) an error in passing in the required dependencies to the module (ngRoute the most common, but anything else that is required will throw that uncaught object error):

var app = angular.module('app', ['ngRoute']);

If that is not a simple fix for you, a way to get an actual debug message easily is to use an unminified source for angular, and run it in Chrome Canary build.

http://www.google.com/intl/en/chrome/browser/canary.html