I am using Angular 1.2.27 and having a very strange error come up which cannot find where its coming from.
TypeError: e is not a function
at angular.min.js:122
at e (angular.min.js:37)
at angular.min.js:41
This is the only error I receive, nothing is broken and the app is working fine.
@mwils-bp it is impossible to say with a minified code and without knowing AngularJS version. Try with the un-minified framework - maybe it will help you narrow down the problem so you can post a reproduce scenario.
In any case we can't confirm / fix bugs that we can't reproduce....
@mwils-bp, here's a jsbin to get you started on reproducing the issue. It's using the unminified Angular 1.2.27, has an app module and a MainCtrl. From there, try to reproduce the issue and the angular team or others will be able to help you further. Good luck!
@pkozlowski-opensource I have specified which version, 1.2.27.
@kentcdodds I'm using ui-router with templateUrl's so will be a bit tricky, but i'll get one created shortly.
Its just a strange issue that its not an error given by Angular, but instead an error coming from angular.min.js itself.
Thanks for your help!
@mwils-bp try the non-minified version and post the entire stack trace, this would give some pointers...
@pkozlowski-opensource here is the error given from the un-minified version of 1.2.27:
(anonymous function) @ angular.js:9827sendReq @ angular.js:9628$get.serverRequest @ angular.js:9344processQueue @ angular.js:13189(anonymous function) @ angular.js:13205$get.Scope.$eval @ angular.js:14401$get.Scope.$digest @ angular.js:14217$get.Scope.$apply @ angular.js:14506bootstrapApply @ angular.js:1448invoke @ angular.js:4185doBootstrap @ angular.js:1446bootstrap @ angular.js:1466angularInit @ angular.js:1360(anonymous function) @ angular.js:26176m.Callbacks.j @ jquery.min.js:2m.Callbacks.k.fireWith @ jquery.min.js:2m.extend.ready @ jquery.min.js:2J @ jquery.min.js:2
angular.js:11607 TypeError: fn is not a function
at angular.js:16223
at completeOutstandingRequest (angular.js:4905)
at angular.js:5285(anonymous function) @ angular.js:11607$get @ angular.js:8557(anonymous function) @ angular.js:16226completeOutstandingRequest @ angular.js:4905(anonymous function) @ angular.js:5285
@mwils-bp hmm, from the stack trace we can see that this happens happens during $http request but the line numbers don't seem to match 1.2.27.... I'm afraid that it will be very hard to act on this one without a narrowed-down reproduce scenario....
End user here. I'm getting the same error (e is not a function) from firefox 38.0 (37.0.2 works) on a third-party web site that breaks that third-party web site. Looking at the console, and the angular.min.js and grovelling back into the source code I find this is the code that triggers the error (reportedly from angular.min.js version 1.2.8)
$apply:function(a){try{return m("$apply"),this.$eval(a)}catch(b){e(b)}finally{p.$$phase=null;try{p.$digest()}catch(c){throw e(c),c;}}}
In particular:
$apply:function(a){try{ [snip] } catch(b){ HERE IS e(b) THE ERROR }finally{ [snip] }}
which seems to match this code from src/ng/rootScope.js
$apply: function(expr) {
try {
beginPhase('$apply');
return this.$eval(expr);
} catch (e) {
$exceptionHandler(e);
} finally {
clearPhase();
try {
$rootScope.$digest();
} catch (e) {
$exceptionHandler(e);
throw e;
}
}
},
Which is unchanged for many years.
The "catch(e) { $exceptionHandler(e)" code is being replaced with "catch(b) { e(b)" during the minimization process.
Unfortunately, that's were my understanding of Javascript and Angular run out. Perhaps this helps one of the Angular developers figure out why the minimization (closure) produced a code reference to an undefined function?
@ppokorny it sounds like you have (or someone else has) modified angular in some way --- a number if things could be happening:
this.$get = ['...', '$exceptionHandler', ...]) could be accidentally removed. This style allows the correct things to be injected even when binding names are mangled by minfiers.Both of these seem unlikely, but worth investigating. http://plnkr.co/edit/7Lp7HSkinh8aPQKvJUx1?p=preview runs the first $exceptionHandler block in $apply without failure on FF38 on my machine, using the minified version of 1.2.28 hosted on ajax.googleapis.com, and there's no reason the 2nd one would fail unless a variable resolution bug crept into a stable build of Firefox, which seems highly unlikely.
I don't have much to add to this, except that I am seeing evidence of this error as well. Angular 1.2.8 for me. The error occurs on the same $exceptionHandler(e); line within the $apply function. I say "evidence" because I have only seen it in Sentry (remove JS error logging service), but I haven't yet been able to reproduce it. I can say that my copy of Angular is not modified in any way, it's a direct copy of https://ajax.googleapis.com/ajax/libs/angularjs/1.2.8/angular.min.js.
I was face same problem, But I was resolve this by simply rename the controller function where form is submitted.
Check this.
Before function name when I was get error:
$scope.function_submit_form=function(){}
After rename this to $scope.functionSubmitForm=function(){} then I am not get above error.
I think angular not get '_' in function name.
@vijaysutar, thereshould be no problem using _ in function names (at least Angular is fine with it).
I'm gonna close this issue as there's not enough information to act on it.
I was able to replicate this by accidently putting a function call in a $interval.
$interval(fun(), 10000);
instead of
$interval(fun, 10000);
i'm getting
TypeError: a is not a function
at angular.min.js:72
at E (angular.min.js:100)
at E (angular.min.js:100)
at angular.min.js:101
at k.$eval (angular.min.js:112)
at k.$digest (angular.min.js:109)
at k.$apply (angular.min.js:112)
at h (angular.min.js:72)
at u (angular.min.js:77)
at XMLHttpRequest.w.onreadystatechange (angular.min.js:79)
Most helpful comment
I was able to replicate this by accidently putting a function call in a $interval.
$interval(fun(), 10000);
instead of
$interval(fun, 10000);