I am wondering if it is possible or even wanted to have a provider return variables / functions dynamically?
I have been creating a plnkr here.
What I basically trying to do is instead of returning keys
in the $get
method of the MyLogProvider
, I would like to return everything without using keys
with it.
So for example I would like to change:
MyLog.keys.auth('This is going to be logged into the app:auth namespace');
To:
MyLog.auth('This is going to be logged into the app:auth namespace');
Therefore I need to change the output of below dynamically by looping over all keys
, is this possible?
$get: function() {
return {
keys: keys
}
}
Thanks to @MichaelRadionov:
Change:
$get: function() {
return {
keys: keys
}
}
To
$get: function() {
return keys;
}
See next plnkr