Here\'s a normal ES5 function in my Angular code which works:
app.run(function($templateCache){ $templateCache.put(\'/some\',\'thing\') });
I tried another variation which worked: (x)=>…
(instead of x=>…
)
app.run(($templateCache) => $templateCache.put('/some','thing'));
I guess it needs parentheses for some reason
Correct. Your version of AngularJS is not compatible with arrow functions that make use of $injector.
This is mainly because AngularJS 1.4.6 makes use of (Function).toString
, which does not start with function(
for arrow functions, at least in Firefox:
>var a = () => 5
function a()
>a.toString()
"() => 5" // not "function a() {return 5;}"
AngularJS supports the arrow notation from 1.5.0 onwards.