我似乎有点卡在这里试图设置我的新应用程序。
我试过了:
import angular from 'angular';
var myApp = angular.module('myApp', []);
我试过了:
const angular = require('angular');
var myApp = angular.module('myApp', []);
我仍在继续
Uncaught Error: [$injector:modulerr] Failed to instantiate module app due to:
Error: [$injector:nomod] Module 'app' 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.
http://errors.angularjs.org/1.6.4/$injector/nomod?p0=app
at eval (eval at <anonymous> (http://localhost:8080/app.bundle.js:322:1),
我已经用npm安装了角度,这来自我的package.json
"dependencies": {
"angular": "^1.5.0",
"angular-route": "^1.6.4",
"bootstrap": "^3.3.7"
},
有什么想法吗?
答案 0 :(得分:3)
正如错误所说
<强> Error: [$injector:nomod] Module 'app' is not available!
强>
在您的应用中的某个位置,您尝试使用 ng-app='app'
,将其重命名为 ng-app='myApp'