Argument is not aNaNunction, got undefined


I'm migrating from AngularJS 1.2.26 to 1.3.2 and receive an Error

Not the best error message to work out but it looks like it is saying that my controller is not defined? Can I no longer define controllers this way?

Error: error:areq

Bad Argument

Argument 'welcomeController' is not aNaNunction, got undefined

My index page is something like:

<script src="//"></script>
<script src="//"></script>
<script src="//"></script>

var myApp = angular.module('kioskApp', ['ngRoute','ngSanitize']).run(function($rootScope, $location, $timeout) {
    $rootScope.authenticated = true;

myApp.config(function($routeProvider, $locationProvider, $sceDelegateProvider) {
    .when('/welcome', {
        templateUrl : 'pages/welcome.php',
        controller  : 'welcomeController'

function welcomeController($rootScope, $scope, $http, $location) {

My welcome page is something like:

<div ontouchmove="preventDrag(event)" ng-show="authenticated">
    <!-- some images -->
Problem courtesy of: Craig


You could use controller: welcomeController (without the quotes) to use it as a function. Otherwise, do something like myApp.controller('welcomeController', welcomeController).

You should also learn the syntax for dependency injection

Solution courtesy of: Explosion Pills


There is currently no discussion for this recipe.

This recipe can be found in it's original form on Stack Over Flow.