<% environment.context_class.instance_eval { include ActionView::Helpers } %>
<% environment.context_class.instance_eval { include HostHelper } %>
<% environment.context_class.instance_eval { include Rails.application.routes.url_helpers } %>

App.controller 'HomeCtrl', ['$scope', '$location', '$timeout', '$http', \
                            ($scope, $location, $timeout, $http) ->
  $scope.results = []

  $scope.$watch 'search', ->
    if $scope.search.length > 2
      $http.get('<%= angularApiPath(api_charity_search_path) %>', {
        params: {
          q: $scope.search,
        },
      }).success((data, status, headers, config) ->
         $scope.results = data.results
       ).error((data, status, headers, config) ->
       )

]

<% environment.context_class.instance_eval { include ActionView::Helpers } %>
<% environment.context_class.instance_eval { include HostHelper } %>
<% environment.context_class.instance_eval { include Rails.application.routes.url_helpers } %>

App.controller 'HomeCtrl', ['$scope', '$location', '$timeout', '$http', \
                            ($scope, $location, $timeout, $http) ->
  $scope.results = []

  $scope.$watch 'search', ->
    if $scope.search?.length > 2
      $http.get('<%= angularApiPath(api_charity_search_path) %>', {
        params: {
          q: $scope.search,
        },
      }).success((data, status, headers, config) ->
         $scope.results = data.results
       ).error((data, status, headers, config) ->
       )

]

Fix existence check of search.
Fix existence check of search.
