I am using Angular 1.3.15, also tried 1.2.28, as well as Angular bootstrap. Last night, after updating Chrome to v42.0.2311.90, I suddenly began to detect tons of Angular itkn errors:
Error: [$injector:itkn] Incorrect injection token! Expected service name as string, got function () http://errors.angularjs.org/1.3.15/$injector/itkn?p0=function%20() at REGEX_STRING_REGEXP (angular.min.js?bust=undefined:63) at Object.invoke (angular.min.js?bust=undefined:4189) at angular.min.js?bust=undefined:6525 at forEach (angular.min.js?bust=undefined:323) at Object.<anonymous> (angular.min.js?bust=undefined:6523) at Object.invoke (angular.min.js?bust=undefined:4204) at Object.enforcedReturnValue [as $get] (angular.min.js?bust=undefined:4056) at Object.invoke (angular.min.js?bust=undefined:4204) at angular.min.js?bust=undefined:4021 at Object.getService [as get] (angular.min.js?bust=undefined:4162)
This did not happen before the Chrome update, but I think I canβt say that this is exactly related.
After scrolling, I found that any directives defined as follows:
.directive('modalTransclude', function () { return {
itkn error. I have console.logged key in the $inject test in Angular, and it returns a function of the directive itself, and not just strings like this were clearly intended.
I found that wrapping a function in an array, even without any lines defining the injections, solves the problem:
.directive('modalTransclude', [function () { return {
However, this error does not occur on the Angular bootstrap site, and I tried this on both versions of Angular versions 1.3 and 1.2.
I will continue to search for any reasons that are unique to my application, but does anyone know what causes this?
angularjs angular-bootstrap
helion3
source share