Error: $controller:ctrlreg A controller with this name is not registered.

The controller with the name 'SomeController' is not registered.
名称为'SomeController'的控制器没注册 ;

Description

This error occurs when the $controller() service is called with a string that does not match any of the registered controllers. The controller service may have been invoked directly, or indirectly, for example through the ngController directive, or inside a component / directive /route definition (when using a string for the controller property). Third-party modules can also instantiate controllers with the $controller()service.

当使用不匹配任何注册控制器的字符串调用$ controller()服务时,会发生此错误。 控制器服务可以直接或间接地被调用,例如通过ngController指令或组件/指令/路由定义(当使用控制器属性的字符串时)。 第三方模块还可以使用$ controller()服务实例化控制器。

Causes for this error can be:

  1. Your reference to the controller has a typo. For example, in the ngController directive attribute, in a component definition's controller property, or in the call to $controller().
  2. You have not registered the controller (neither via Module.controller nor $controllerProvider.register().
  3. You have a typo in the registered controller name.

Please consult the $controller service api docs to learn more.

导致此错误的原因可能是:

您对控制器的引用有错字。 例如,在ngController指令属性中,在组件定义的控制器属性中,或在$ controller()的调用中。
您尚未注册控制器(不通过Module.controller或$ controllerProvider.register())。
您在注册的控制器名称中输入错字。
请参阅$ controller service api docs了解更多信息。

原文地址:https://www.cnblogs.com/JackeyLove/p/7680985.html