[英]Grunt livereload breaks when adding directive to AngularJS app (generated with Yeoman)
I have an AngularJS app, generated with Yeoman, with all addons enabled (such as Bootstrap, SASS...). 我有一个用Yeoman生成的AngularJS应用,并启用了所有插件(例如Bootstrap,SASS ...)。
Livereload was working fine, until i added a directive. Livereload运行良好,直到我添加了一条指令。 I put it in the directory /app/scipts/directives/myDirectives.js.
我将其放在目录/app/scipts/directives/myDirectives.js中。
This is the content of myDirectives.js: 这是myDirectives.js的内容:
app.directive('setGroupName', function() {
return {
templateUrl: 'views/setGroupName.html'
};
});
Regardless of whether or not I use the setGroupName directive anywhere, simply including the file in my index.html like so 不管我是否在任何地方都使用setGroupName指令,只需像这样在index.html中包含文件
<script src="scripts/directives/myDirectives.js"/>
causes Grunt's livereload to stop working. 使Grunt的livereload停止工作。
PS: Using the directive works (when it is included). PS:使用该指令有效(包括该指令时)。 I use the set-group-name directive in createGroup.html (like shown below) and the contents of setGroupName.html are displayed.
我在createGroup.html中使用set-group-name指令(如下所示),并显示setGroupName.html的内容。
<div set-group-name></div>
Setup: I have not edited the gruntfile, so anything not mentioned here I believe is standard for the 设置:我尚未编辑gruntfile,因此我认为此处未提及的内容是
$ yo angular
setup, generating it with all addons enabled. 安装程序,并在启用所有插件的情况下生成它。
Is there something wrong in the myDirectives file? myDirectives文件中有问题吗? Or it's location?
还是位置?
Grunt livereload breaks because of this line 由于这条线,咕unt的livereload中断
<script src="scripts/directives/myDirectives.js"/>
changing it to 更改为
<script src="scripts/directives/myDirectives.js"></script>
fixes it! 解决它!
Noob mistake, I guess, and not related to directives. 我猜是Noob的错误,与指令无关。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.