Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AngularJS Error: [$injector:itkn] Incorrect injection token! Expected service name as string, got undefined

Trying to run an Angular app containing this controller:

routerApp.controller('chartSettingsCtrl', ['$scope', '$timeout', 
 , function($scope, $timeout) { /* body omitted */ }

gives me the error:

Error: [$injector:itkn] Incorrect injection token! Expected service name as string, got undefined

What am I doing wrong?

like image 635
Sajeetharan Avatar asked Nov 26 '22 21:11

Sajeetharan


1 Answers

The actual problem is that I had an extra , in the controller. When I changed that, it worked.

From

routerApp.controller('chartSettingsCtrl', ['$scope', '$timeout',
 , function($scope, $timeout) {

To

routerApp.controller('chartSettingsCtrl', ['$scope', '$timeout',
 function($scope, $timeout) {
like image 73
Sajeetharan Avatar answered May 28 '23 01:05

Sajeetharan