I have two controllers in two different modules, I need to call the function of the child controller in the parent controller. Already tried $ rootScope, but it does not work in this case.
Here is the code for the function of the child controller:
$scope.processSignOut = function () {
LogoutService.save(
function (response) {
$state.go('support.login');
}, function (error) {
showAlert('danger',
'logout unsuccessfull. Please try again.');
});
};
Parent controller
$rootScope.logout = function () {
$rootScope.processSignOut();
};
HTML code
<button type="button" class="btn btn-secondary btn-block"
ng-click="logout()">Logout
</button>
source
share