AngularJS Controller Declaration -- Error: $controller:ctrlreg

AngularJS Controller Declaration -- Error: $controller:ctrlreg

我在 angularJs 中有一个名为 "BasicController" 的基本控制器。 下面是我的代码 (BasicController.js):

(function () {
       var app = angular.module("app", []);
       app.controller("BasicController", function ($scope) {
       alert(2);
       $scope.menus = ["Profile", "About", "Contact"];
    });
}());

但是当我运行这个项目下面显示错误。实际上错误说什么我无法理解。请有人解释一下这实际上是问题所在。

你关注的不是一个好东西,你需要为模块创建一个单独的文件,为控制器创建一个单独的文件。并将这两个文件都包含在您的索引文件中。 使用此指南作为最佳实践。 https://github.com/johnpapa/angular-styleguide/tree/master/a1