以下是我在 Angular 1.x 中的控制器的外观 -
const app = angular.module("userRegistration", [
"some-dep",
"templates",
"ngRoute",
"ngResource",
"ngCookies",
"userRegistration.controllers",
"userRegistration.services",
"userRegistration.directives"
]);
一切运行良好,但偶尔会出现以下错误,主要是在 Chrome 浏览器版本 >= 62 的 Windows 机器上 -
Uncaught Error: [$injector:modulerr] Failed to instantiate module userRegistration due to: Error: [$injector:nomod] Module 'userRegistration' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.
我从另一篇 SO帖子中得知问题出在语法上。正确的语法是
var app = angular.module("MesaViewer", []);
但我不确定为什么这个错误过去从未出现过。我试图在相同的 chrome 浏览器版本上重现该问题,但无法解决。