dimanche 23 mars 2014

Angular argument X is not a function, got undefined


Vote count:

0




Hi there I have an error: Error: [ng:areq] Argument 'homeApp.HomeCtrl' is not a function, got undefined



// homeController.js

'use strict';

angular.module('homeApp').controller('HomeCtrl', ['$scope', function($scope) {

// object to hold all the data for the new comment form
$scope.commentData = {};

// loading variable to show the spinning loading icon
$scope.loading = true;
}]);


main file:



// app.js
'use strict';

angular.module('homeApp', []);

var myApp = angular.module('myApp', ['ngRoute', 'homeApp']).
config(['$routeProvider', function($routeProvider) {
$routeProvider.when('/view1', {
templateUrl: 'partials/login.html',
controller: 'homeApp.HomeCtrl'
});

$routeProvider.when('/view2', {templateUrl: 'partials/partial2.html', controller: 'MyCtrl2'});
}]);


I am loading files in this order: app.js, homeController.js



asked 48 secs ago






Aucun commentaire:

Enregistrer un commentaire