I've got a controller with a http request, and I need to call it from another controller, this is the controller i need to launch:
app.controller('getDataCtrl', function ($scope, $http, $ionicLoading) {
$scope.request = $http({
method: "POST",
url: "someurl",
dataType: "json",
contentType: "application/json; charset=utf-8"
}).then(function mySucces(response) {
$scope.allTracks = response.data;
$scope.recentTracks = response.data.Tracks;
}
and this is how i tried to call it:
angular.element(document.getElementById('getDataCtrl')).$scope.$apply();