title: how to call angular scope function from javascript function inside controller
body: <p>I have angular controller and Javascript function in that function , i am calling angular function. I am getting error: $scope.Name is not a function, $scope.dates is not a function.</p>
  
  <pre><code>     function validation() {
              $scope.pageload = true;
  
              $scope.Name();
              $scope.dates();  
          }
  
          $scope.Name = function () {
             // do something
          }
  
          $scope.dates = function () {
            // do something       
          }
  </code></pre>
  
  <p>working fine inside the controller</p>
  
  <pre><code>    var MyController = function ($scope, service)
      {
  
  
         function validation() {
  
              $scope.pageload = true;
  
              $scope.Name();
           $scope.dates();
  
          }
  
         $scope.Name = function () {
  
  
              // do something
          }
  
       $scope.dates = function () {
  
              // do something
  
      }
  
  
  });
  
  
  working:
  
  
  var MyController = function ($scope, service)
  {
   LoginHomeService.getHomeService(function (data) {
                  $rootScope.CT1SessionObj = data.CT1SessionObj;
  
                          validation();
  
  
  
                                      }, function (response) {
                                          alert(response.Message);
                                      });
  
     function validation() {
  
          $scope.pageload = true;
  
          $scope.Name();
       $scope.dates();
  
      }
  
     $scope.Name = function () {
  
  
          // do something
      }
  
   $scope.dates = function () {
  
          // do something
  
  
  
  
  });
  
  
  
  
  Not working:
  
      var MyController = function ($scope, service)
      {
       LoginHomeService.getHomeService(function (data) {
                      $rootScope.CT1SessionObj = data.CT1SessionObj;
  
                              validation();
  
  
     function validation() {
  
          $scope.pageload = true;
  
           $scope.Name();
           $scope.dates();
  
          }
  
         $scope.Name = function () {
  
  
              // do something
          }
  
       $scope.dates = function () {
  
              // do something
  
      }
  
  
     }, function (response) {
      alert(response.Message);
     });
  
  
     });
  </code></pre>