title: How to call external class into AngularJS controller
body: <p>I have a method inside an external javascript class.i'm trying to call that method inside to my controller function.(there is a toggle button in my view,when toggle is <code>checked</code>,i want to call external method)</p>
  
  <p><strong>Controller</strong></p>
  
  <pre><code>myApp.factory('PushClient', ['', function() {
  
      return PushClient;
  }]);
  
  myApp.controller('MainController', function (PushClient,$scope, $rootScope, $http, $window){
  
  $rootScope.toggleSelection = function toggleSelection(event) {
  
      if(event.target.checked){
  
        var PushClient = new PushClient();
        PushClient.mypush();
      }else {
  
      }
    };
  
  }
  </code></pre>
  
  <p><strong>external PushClient class</strong></p>
  
  <pre><code>class PushClient {
  constructor(....){...}
         ............
  
      mypush(){
          alert("hiiii");
      }
  }
  </code></pre>