I need to call a function in another controller from a link.
Now I'm in controller DashboardCtrl and I need to call function aggiornaListamedici() that is in controller AggiornaCtrl, how can I do that starting from a link??
This is my code now:
HTML
<div>
<a href="#/aggiorna" ng-click="aggiornaListamedici()">
<span ng-class="{button_download:true}"></span>
</a>
</div>
ROUTING
medicoFvgAppModule.config(['$routeProvider', function($routeProvider) {
$routeProvider.when('/aggiorna', {templateUrl: 'partials/dashboard.html', controller: 'AggiornaCtrl'});
$routeProvider.otherwise({redirectTo: '/dashboard'});
}])
CONTROLLER
medicoFvgAppControllers.controller('DashboardCtrl', ['$scope','$location','$rootScope',
function($scope,$location,$rootScope) {
// my controller dashboard
}]);
medicoFvgAppControllers.controller('AggiornaCtrl', ['$scope', '$rootScope','$http', '$timeout', function($scope, $rootScope, $http, $timeout) {
$scope.aggiornaListamedici = function(){
// my function
}
}]);