title: Angular JS is Giving an Undefined Function Error
body: <p>I'm writing a back end application that shows listings similar to a phone book. I have some filters that it sorts by and pagination as well.  The app loads all the data first and then the filtering and pagination is essentially done instantly.  I can't figure out what the problem is here.   From online and my book everything appears to be OK.  This is the error I get: </p>
  
  <pre><code>TypeError: undefined is not a function
  at new &lt;anonymous&gt; (http://local.poha.com/js/ang.js:21:10)
  
  var listingsApp = angular.module('listingsApp', []);
  
  listingsApp.controller('pageController', function ($scope, $http) {
  
      $scope.GetListings();  &lt;--- line 21
  
      $scope.GetListings = function () {
  
          //function code here
  
      }
  
  })
  
  &lt;html ng-app="listingsApp"&gt;
  ...
  &lt;body ng-controller="pageController"&gt;
  
      &lt;div class="pagination"&gt;Page: &lt;span ng-repeat="page in pages"&gt;
          &lt;a href="" ng-click="GoToPage($index)"&gt;{{$index + 1}}&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;
      &lt;/div&gt;
      &lt;table id="updateTable" width="2000" cellpadding="4" cellspacing="4" border="0"&gt;
  
      ...
  
          &lt;tr ng-repeat="listing in allListings"&gt;
              &lt;td&gt;{{listing.id}}&lt;/td&gt;
              &lt;td&gt;{{listing.name}}&lt;/td&gt;
              &lt;td&gt;{{listing.address}}&lt;/td&gt;
              &lt;td&gt;{{listing.city}}&lt;/td&gt;
              &lt;td&gt;{{listing.state}}&lt;/td&gt;
      ...
  </code></pre>