I'm assuming this is quite straightforward, but how can I have global functions that I can access in my controllers by storing the function in the '.run' phase?
Quite simply, a button is clicked in the DOM that triggers the global function that is called in the appropriate controller..
I've tried various methods and would like a really simple approach to this that helps to minimise the amount of code I've currently got. See below:
**HTML**
<input data-ng-click="clearSignInError()" data-ng-model="email"
type="email"
id="inputEmail" class="form-control" placeholder="Email address"
required>
**JS**
app.run(['$rootScope', '$state', function($rootScope, $state) {
$rootScopecope.clearSignInError = function () {
$rootScope.loginError = null;
$rootScope.loginSuccess = null;
};
}]);
app.controller('loginCtrl', ['$scope', 'Auth', '$state', '$rootScope'
function($scope, Auth, $state, $rootScope) {
$rootScope.clearSignInError()
}]);