aboutsummaryrefslogtreecommitdiffstats
path: root/src/Angular.js
diff options
context:
space:
mode:
authorMisko Hevery2011-02-16 19:18:35 -0500
committerMisko Hevery2011-02-18 13:14:07 -0800
commit7d4aee31bb202e9b050fc15c56cfc33c46b9eaf5 (patch)
tree3c503f5ac9104983d3ed665da76a464142e94a53 /src/Angular.js
parent7a54d2791ff4de5808970f3862114f84121115b5 (diff)
downloadangular.js-7d4aee31bb202e9b050fc15c56cfc33c46b9eaf5.tar.bz2
Auto create $inject property form the argument names. Any arg starting with $ or _ will be injected
Diffstat (limited to 'src/Angular.js')
-rw-r--r--src/Angular.js9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/Angular.js b/src/Angular.js
index 2d4b1671..05b9989e 100644
--- a/src/Angular.js
+++ b/src/Angular.js
@@ -1077,10 +1077,15 @@ function bindJQuery(){
/**
* throw error of the argument is falsy.
*/
-function assertArg(arg, name) {
+function assertArg(arg, name, reason) {
if (!arg) {
- var error = new Error("Argument '" + name + "' is required");
+ var error = new Error("Argument '" + (name||'?') + "' is " +
+ (reason || "required"));
if (window.console) window.console.log(error.stack);
throw error;
}
};
+
+function assertArgFn(arg, name) {
+ assertArg(isFunction(arg, name, 'not a function'));
+};