I'm attempting to invoke a function within an Angular controller from outside of the controller. Here's an example snippet of my code:
var myApp = angular.module('myApp'[])
.controller('MainController', ['$scope', function($scope) {
$scope.message = function() {
alert('Hello World');
};
}]);
function talk() {
// message()
}
My goal is to be able to utilize my message() function inside my talk() function.
Due to the complexity of my application, this seems like the most straightforward approach for me. However, I am open to any suggestions you may have for a more efficient solution.
Thank you!