title: angular Js call function outside of given function
body: <pre><code>    google.maps.event.addListener(marker, 'dragend', function() {
         getmydata = function() {
              return $http.get("getConnectionData.php").then(function (response) {
                           $scope.links1 = response.data.records;
                     });
  
                 }
  
                getmydata().then(function(data) {
                // stuff is now in our scope, I can alert it
                console.log("hiiiii" , $scope.links1);
                });
  
  
   });
  </code></pre>
  
  <p>Here I want to call this section outside of dragend function-  google.maps.event.addListener(marker, 'dragend', function() { </p>
  
  <pre><code>getmydata().then(function(data) {
      // stuff is now in our scope, I can alert it
       console.log("hiiiii" , $scope.links1);
  });
  </code></pre>
  
  <p>How can I do this .</p>