Error: $controller:ctrlreg The controller with the name '{0}' is not registered
问题 app.js (function(){ 'use strict'; angular .module('app', ['ngRoute', 'ngCookies']) .config(config) config.$inject = ['$routeProvider', '$locationProvider']; function config($routeProvider, $locationProvider){ $routeProvider .when('/', { controller: 'HomeController', templateUrl: 'home/home.html', controllerAs: 'vm' }) } })(); home.controller.js (function () { 'use strict'; angular .module('app') .controller('HomeController', HomeController); HomeController.$inject = ['UserService', '