模块不可用,拼写错误或忘记加载(但我没有) [英] Module is not available, misspelled or forgot to load (but i didnt)
问题描述
我是相当新的角度和使用它与JSON API文件。为了测试,我想使用免费的GitHub的API(我的函数的名称是,我将在以后的工作不同的JSON API)。我只是想看看我的职能与工作console.logs,但我在控制台收到此错误。
I am fairly new to angular and using it with JSON api files. TO test, i am trying to use the free github api (my names for functions are for a different json api that i will be working with later). I just wanted to see if my functions were working with the console.logs, but i receive this error in the console.
未捕获的错误:[$喷油器:modulerr]未能实例由于模块MesaViewer:
错误:[$喷油器:NOMOD]模块'MesaViewer不可!你要么拼写错误的模块名称,或忘了加载它。如果注册一个模块,确保指定的依赖关系作为第二个参数。
Uncaught Error: [$injector:modulerr] Failed to instantiate module MesaViewer due to: Error: [$injector:nomod] Module 'MesaViewer' 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.
我已阐明MesaViewer在两个完全相同的,并且相关性在第二行看到!
I have spelled MesaViewer the exact same in both, and dependencies are seen in the second line!
var app = angular.module("MesaViewer");
var MainController = function($scope, $location, $http, $routeParams) {
我做了什么错?
这里是我的普拉克: http://plnkr.co/edit/sZPaFbzbOB6AmVCLL1vq
推荐答案
这应该是
var app = angular.module("MesaViewer", []);
这是你需要定义一个模块的语法和您需要的数组以显示它没有依赖关系。
This is the syntax you need to define a module and you need the array to show it has no dependencies.
您使用
angular.module("MesaViewer");
当你引用你已经定义的模块语法。
syntax when you are referencing a module you've already defined.
这篇关于模块不可用,拼写错误或忘记加载(但我没有)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!