无法读取未定义的属性“模块" [英] Cannot read property 'module' of undefined

查看:123
本文介绍了无法读取未定义的属性“模块"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对DjangoJS有基本的了解,最近我开始学习Angular.js.我编写了使用Angular显示硬编码的json的代码,但失败了.我收到以下错误:

I have a basic understanding of Django and JS and recently I started learning Angular.js. I wrote code for showing hardcoded json using Angular and failed. I got the following error:

Uncaught TypeError: Cannot read property 'module' of undefined at line 10 of django-angular.js

我浏览了文件并看到以下行:

I went through the file and saw this line:

var djng_forms_module = angular.module('ng.django.forms', []);

我不知道未定义的错误含义.我浏览了一些存在类似问题但没有成功的链接.

I don't know what the error means by undefined. I went through some of the links having similar problems but with no success.

推荐答案

您忘了在脚本之前加载AngularJS吗?该错误表示Java尚未看到对象angular,因此无法在其上调用module.

Have you forgotten to load AngularJS before your script? The error means that the object angular hasn't been seen by Javascript yet and therefore module cannot be called on it.

(这实际上是一个简化,但是应该说明正在发生的事情)

(that's actually a simplification but it should illustrate what's going on)

这篇关于无法读取未定义的属性“模块"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆