Sometimes I have utility functions that I want to use globally that don't rely on dependency injection in an angularjs app.
I've wanted to throw them in a .constant(..)
but I can't seem to find any documentation advocating this though I do remember someone advising against this. I was thinking something like so
angular.module('myApp', [])
.constant('myFunction', myFunction);
function myFunction(msg) {
alert(msg);
}
Other resources though suggest putting them into a factory or $rootScope. (example) The former feels verbose and the latter I have a distaste for.
Is it acceptable in angularjs 1.x best practices to use .constant to store global functions that don't rely on dependency injection?