angular.module要求不起作用

编程入门 行业动态 更新时间:2024-10-23 20:18:31
本文介绍了angular.module要求不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我是angularjs的新手,我在控制器方面遇到了一些问题.当我尝试在angular.module中放置某些内容时,如果我在require部分中放置了某些内容,则所有页面都将停止工作,我只能指定名称.例如: 如果我输入angular.module('name',[])则不起作用,但是如果我输入angular.module('name')则它可以正常工作.有人知道为什么吗?

I'm new with angularjs and I'm having some problems with the controllers. When I try to put something in the angular.module I only can specify the name, if I put something in the requires part all the page stop working. For example: If I put angular.module('name',[]) it doesn't work but if I put angular.module('name') it works properly. Somebody knows why is it?

推荐答案

此语句

angular.module('name',[])

创建一个模块,而此语句加载该模块

creates a module, whereas this statement loads the module

angular.module('name')

第一个语句应使用一次来定义具有依赖项的模块.之后,应使用第二种格式.

The first statement should be used once to define the module with dependencies. After that the second format should be used.

如果再次使用第一种语法,则会导致模块的重新定义,并且模块上现有的注册都会丢失.

If you use the first syntax again this leads to redefining of module and existing registration on the module are lost.

更多推荐

angular.module要求不起作用

本文发布于:2023-11-01 23:12:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1550683.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:不起作用   angular   module

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!