Skip to main content
added 159 characters in body
Source Link
Pop-A-Stash
  • 6.7k
  • 5
  • 30
  • 54

Your controller definition is incorrect:

angular.module(APP).controller('OutlookMainController', [console[
     console.log('lion king'),
     function () {
          console.log('blah blah');
     }]
]);

When you change the formatting, it's easy to see that you are passing an array as the second argument.

angular.module(APP).controller('OutlookMainController', 
  [console.log('lion king'), function () { console.log('blah blah'); }]
);

angular.module(APP).controller('OutlookMainController', [console.log('lion king'), function() { console.log('blah blah'); }]
);

BUT, the array is supposed to contain injected services and providers, with the final element of the array being the function for your controller. Here, you are inserting a console.log statement. That does not make sense.

And, as you can see from this controller definition in Plunker, this code throws an error in the console: https://next.plnkr.co/edit/cHQjFsx3q0oHvkxC

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

I think what you meant to do was this:

angular.module(APP).controller('OutlookMainController', [function() {
     console.log('lion king'),
     function () {
          console.log('blah blah');
     }
}]);

However, the anonymous function will still not be called unless you call it explicitly, take it out of the function, or define it as self-executing:

angular.module(APP).controller('OutlookMainController', [function() {
     console.log('lion king');

     console.log("blah blah blah");

     (function () {
          console.log('blah blah');
     })();

     function logBlah() {
          console.log('blah blah');
     }
     logBlah();
}]);

AngularJS does not change the basic principles of Javascript.

Your controller definition is incorrect:

angular.module(APP).controller('OutlookMainController', [console.log('lion king'),
     function () {
          console.log('blah blah');
     }]
);

When you change the formatting, it's easy to see that you are passing an array as the second argument. BUT, the array is supposed to contain injected services and providers, with the final element of the array being the function for your controller. Here, you are inserting a console.log statement. That does not make sense.

And, as you can see from this controller definition in Plunker, this code throws an error in the console: https://next.plnkr.co/edit/cHQjFsx3q0oHvkxC

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

I think what you meant to do was this:

angular.module(APP).controller('OutlookMainController', [function() {
     console.log('lion king'),
     function () {
          console.log('blah blah');
     }
}]);

However, the anonymous function will still not be called unless you call it explicitly, take it out of the function, or define it as self-executing:

angular.module(APP).controller('OutlookMainController', [function() {
     console.log('lion king');

     console.log("blah blah blah");

     (function () {
          console.log('blah blah');
     })();

     function logBlah() {
          console.log('blah blah');
     }
     logBlah();
}]);

AngularJS does not change the basic principles of Javascript.

Your controller definition is incorrect:

angular.module(APP).controller('OutlookMainController', [
     console.log('lion king'),
     function () {
          console.log('blah blah');
     }
]);

When you change the formatting, it's easy to see that you are passing an array as the second argument.

angular.module(APP).controller('OutlookMainController', 
  [console.log('lion king'), function () { console.log('blah blah'); }]
);

angular.module(APP).controller('OutlookMainController', [console.log('lion king'), function() { console.log('blah blah'); }]
);

BUT, the array is supposed to contain injected services and providers, with the final element of the array being the function for your controller. Here, you are inserting a console.log statement. That does not make sense.

And, as you can see from this controller definition in Plunker, this code throws an error in the console: https://next.plnkr.co/edit/cHQjFsx3q0oHvkxC

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

I think what you meant to do was this:

angular.module(APP).controller('OutlookMainController', [function() {
     console.log('lion king'),
     function () {
          console.log('blah blah');
     }
}]);

However, the anonymous function will still not be called unless you call it explicitly, take it out of the function, or define it as self-executing:

angular.module(APP).controller('OutlookMainController', [function() {
     console.log('lion king');

     console.log("blah blah blah");

     (function () {
          console.log('blah blah');
     })();

     function logBlah() {
          console.log('blah blah');
     }
     logBlah();
}]);

AngularJS does not change the basic principles of Javascript.

added 159 characters in body
Source Link
Pop-A-Stash
  • 6.7k
  • 5
  • 30
  • 54

Your controller definition is strangeincorrect:

angular.module(APP).controller('OutlookMainController', [console.log('lion king'),
     function () {
          console.log('blah blah');
     }]
);

When you change the formatting, it's easy to see that you are passing an array as the second argument. BUT, the array is supposed to contain injected services and providers, with the final element of the array being the function for your controller. Here, you are inserting a console.log statement. That does not make sense.

And, as you can see from this controller definition in Plunker, this code throws an error in the console: https://next.plnkr.co/edit/cHQjFsx3q0oHvkxC

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

I think what you meant to do was this:

angular.module(APP).controller('OutlookMainController', [function() {
     console.log('lion king'),
     function () {
          console.log('blah blah');
     }
}]);

However, the anonymous function will still not be called unless you call it explicitly, take it out of the function, or define it as self-executing:

angular.module(APP).controller('OutlookMainController', [function() {
     console.log('lion king'),;

     console.log("blah blah blah");

     (function () {
          console.log('blah blah');
     })();

     function logBlah() {
          console.log('blah blah');
     }
     logBlah();
}]);

AngularJS does not change the basic principles of Javascript.

Your controller definition is strange:

angular.module(APP).controller('OutlookMainController', [console.log('lion king'),
     function () {
          console.log('blah blah');
     }]
);

When you change the formatting, it's easy to see that you are passing an array as the second argument. BUT, the array is supposed to contain injected services and providers, with the final element of the array being the function for your controller. Here, you are inserting a console.log statement. That does not make sense. I think what you meant to do was this:

angular.module(APP).controller('OutlookMainController', [function() {
     console.log('lion king'),
     function () {
          console.log('blah blah');
     }
}]);

However, the anonymous function will still not be called unless you call it explicitly or define it as self-executing:

angular.module(APP).controller('OutlookMainController', [function() {
     console.log('lion king'),
     (function () {
          console.log('blah blah');
     })();

     function logBlah() {
          console.log('blah blah');
     }
     logBlah();
}]);

AngularJS does not change the basic principles of Javascript.

Your controller definition is incorrect:

angular.module(APP).controller('OutlookMainController', [console.log('lion king'),
     function () {
          console.log('blah blah');
     }]
);

When you change the formatting, it's easy to see that you are passing an array as the second argument. BUT, the array is supposed to contain injected services and providers, with the final element of the array being the function for your controller. Here, you are inserting a console.log statement. That does not make sense.

And, as you can see from this controller definition in Plunker, this code throws an error in the console: https://next.plnkr.co/edit/cHQjFsx3q0oHvkxC

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

I think what you meant to do was this:

angular.module(APP).controller('OutlookMainController', [function() {
     console.log('lion king'),
     function () {
          console.log('blah blah');
     }
}]);

However, the anonymous function will still not be called unless you call it explicitly, take it out of the function, or define it as self-executing:

angular.module(APP).controller('OutlookMainController', [function() {
     console.log('lion king');

     console.log("blah blah blah");

     (function () {
          console.log('blah blah');
     })();

     function logBlah() {
          console.log('blah blah');
     }
     logBlah();
}]);

AngularJS does not change the basic principles of Javascript.

added 65 characters in body
Source Link
Pop-A-Stash
  • 6.7k
  • 5
  • 30
  • 54

Your controller definition is strange:

angular.module(APP).controller('OutlookMainController', [console.log('lion king'),
     function () {
          console.log('blah blah');
     }]
);

When you change the formatting, it's easy to see that you are passing an array as the second argument. BUT, the array is supposed to contain injected services and providers, with the final element of the array being the function for your controller. Here, you are inserting a console.log statement. That does not make sense. I think what you meant to do was this:

angular.module(APP).controller('OutlookMainController', [function() {
     console.log('lion king'),
     function () {
          console.log('blah blah');
     }
}]);

However, the anonymous function will still not be called unless you call it explicitly or define it as self-executing:

angular.module(APP).controller('OutlookMainController', [function() {
     console.log('lion king'),
     (function () {
          console.log('blah blah');
     })();

     function logBlah() {
          console.log('blah blah');
     }
     logBlah();
}]);

AngularJS does not change the basic principles of Javascript.

Your controller definition is strange:

angular.module(APP).controller('OutlookMainController', [console.log('lion king'),
     function () {
          console.log('blah blah');
     }]
);

When you change the formatting, it's easy to see that you are passing an array as the second argument. BUT, the array is supposed to contain injected services and providers, with the final element of the array being the function for your controller. Here, you are inserting a console.log statement. That does not make sense. I think what you meant to do was this:

angular.module(APP).controller('OutlookMainController', [function() {
     console.log('lion king'),
     function () {
          console.log('blah blah');
     }
}]);

However, the anonymous function will still not be called unless you call it explicitly or define it as self-executing:

angular.module(APP).controller('OutlookMainController', [function() {
     console.log('lion king'),
     (function () {
          console.log('blah blah');
     })();

     function logBlah() {
          console.log('blah blah');
     }
     logBlah();
}]);

Your controller definition is strange:

angular.module(APP).controller('OutlookMainController', [console.log('lion king'),
     function () {
          console.log('blah blah');
     }]
);

When you change the formatting, it's easy to see that you are passing an array as the second argument. BUT, the array is supposed to contain injected services and providers, with the final element of the array being the function for your controller. Here, you are inserting a console.log statement. That does not make sense. I think what you meant to do was this:

angular.module(APP).controller('OutlookMainController', [function() {
     console.log('lion king'),
     function () {
          console.log('blah blah');
     }
}]);

However, the anonymous function will still not be called unless you call it explicitly or define it as self-executing:

angular.module(APP).controller('OutlookMainController', [function() {
     console.log('lion king'),
     (function () {
          console.log('blah blah');
     })();

     function logBlah() {
          console.log('blah blah');
     }
     logBlah();
}]);

AngularJS does not change the basic principles of Javascript.

Source Link
Pop-A-Stash
  • 6.7k
  • 5
  • 30
  • 54
Loading