title: How to execute angular function on page load?
body: <p>Some issue with this code, filltable() function is not firing during page load.
  I have done the back end in webservice.  </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>  
    var app = angular.module("myApp", []);
      app.controller("myCntrl", function ($scope, $http) {
           $scope.fillTable();
          $scope.fillTable = function () {
              $scope.Name= "";
              var httpreq = {
                  method: 'POST',
                  url: 'http://localhost:61292/PPAPI.asmx/GetTables',
                  headers: {
                      'Content-Type': 'application/json; charset=utf-8',
                      'dataType': 'json'
                  },
                  data: {}
              }
              $http(httpreq).success(function (response) {
                  $scope.TableList= response.d;
              })
          };
          $scope.fillTable ();
      });
  &lt;/script&gt;</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.11/angular.min.js"&gt;&lt;/script&gt;</code></pre>
  </div>
  </div>
  </p>