在 AngularJS 中使用 ng-app 指令的问题

Problem of using ng-app directives in AngularJS

我正在向 w3schools.com 学习 AngularJS。

this example 中,该应用程序运行良好,但如果我为 ng-app 指定任何名称,则它无法运行。为什么会这样?以及如何调试 AngularJS 代码,因为有时它不会向控制台报错。

ngApp is an optional application module name to load.

您可以阅读有关 ngApp 的更多信息。

The angular.module is a global place for creating, registering and retrieving AngularJS modules. All modules (AngularJS core or 3rd party) that should be available to an application must be registered using this mechanism.

您可以阅读有关 angular.module 的更多信息。

如果您不指定 ng-app,您将无法使用服务、指令、控制器、过滤器和配置信息。如果你只是将它保留为 ng-appng-app="",那么你将只获得基本的 angular 功能上班。

然后看看