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 checked,i want to call external method)
Controller
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 {
}
};
}
external PushClient class
class PushClient {
constructor(....){...}
............
mypush(){
alert("hiiii");
}
}