【发布时间】:2017-06-09 11:48:26
【问题描述】:
我在尝试设置我的新应用时似乎有点卡住了。
我试过了:
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 安装了 angular,这是来自我的 package.json
"dependencies": {
"angular": "^1.5.0",
"angular-route": "^1.6.4",
"bootstrap": "^3.3.7"
},
有什么想法吗?
【问题讨论】:
-
您的模块名称是
myApp而不是app只需检查您在ng-app指令中使用了什么