我是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要求不起作用
发布评论