How can I access the variable of app.run() in angularjs 1.7 from a app.directive()
angular.module('myApp', [
]).config(function(){
// someCodes
}).run(function(){
var getLifeSpan = function(LifeSpan){
var number = eval(LifeSpan)
return Math.abs(number);
}
});
I want to access "var getLifeSpan" here in directive()
angular.module('myApp')
.directive('lifeSpan', function ($rootScope) {
return {
link : function(scope, element, attrs){
Some Codes. . .
}
}
}
Is this possible?