@cz2246 asked: How do we access arguments of the function passed as argument. For example in:
var injectedFunc = app.inject(function (Auth, User, MainCtrl, sum) {
return [Auth(), User(), MainCtrl(), sum(1, 2)].join(', ');
});
How can we access the names of the argumnets?
My response:
@cz2246 In this case, the first parameter to inject is a function. All functions have a toString() method that essentially converts the function into its source code version as a string. You then have to parse using a regular expression to get all of the parameters that are passed into that function. Make sense?
@cz2246 asked: How do we access arguments of the function passed as argument. For example in:
var injectedFunc = app.inject(function (Auth, User, MainCtrl, sum) {
return [Auth(), User(), MainCtrl(), sum(1, 2)].join(', ');
});
How can we access the names of the argumnets?
My response:
@cz2246 In this case, the first parameter to inject is a function. All functions have a toString() method that essentially converts the function into its source code version as a string. You then have to parse using a regular expression to get all of the parameters that are passed into that function. Make sense?