AngularJS NG-视图不加载JS [英] AngularJS ng-view not loading js
问题描述
我和我的AngularJS应用程序的一个问题。我试图用一个自举模板的JavaScript中的NG-观点在里面,但不工作。
当我使用该JavaScript在我的索引的伟大工程,而不是内部的任何看法。
I have a problem with my AngularJS app. I'm trying to use a JavaScript of a bootstrap template inside of a ng-view, but is not working. When I use this JavaScript in my index works great, but not inside of any view.
这是我的index.html的一部分:
This is a part of my index.html:
<!-- Breadcrumb -->
<ng-view>
</ng-view>
<!-- Javascript Libraries -->
<!-- jQuery -->
<script src="js/jquery.min.js"></script> <!-- jQuery Library -->
<script src="js/jquery-ui.min.js"></script> <!-- jQuery UI -->
<script src="js/jquery.easing.1.3.js"></script> <!-- jQuery Easing - Requirred for Lightbox + Pie Charts-->
<!-- Bootstrap -->
<script src="js/bootstrap.min.js"></script>
<!-- Form Related -->
<script src="js/select.min.js"></script> <!-- Custom Select -->
<script src="js/chosen.min.js"></script> <!-- Custom Multi Select -->
<script src="js/datetimepicker.min.js"></script> <!-- Date & Time Picker -->
<script src="js/colorpicker.min.js"></script> <!-- Color Picker -->
<script src="js/icheck.js"></script> <!-- Custom Checkbox + Radio -->
当我使用一些任何一个NG-视图里面的形式相关的脚本的功能不起作用。
When I use some of the features of any of the form related scripts inside of a ng-view don't work.
我如何使用我的里面NG-这种看法?脚本我试图加载NG-意见里面的脚本,但仍然无法正常工作。
How can I use this scripts inside my ng-views?? I've tried to load the scripts inside the ng-views but still doesn't work.
推荐答案
这是很难从code段看,但你angularjs文件之前尝试加载jQuery的?角与工程和jqLite如果不加载的jQuery angularjs文件的角度尝试之前jqLite加载它。
It's hard to see from your code snippet, but have you tried loading jquery before angularjs file ? Angular works with jqLite and if your not loaded jQuery before angularjs file angular tries to load it with jqLite.
但是,这是pffered你的jQuery插件转换为指令,以便他们在您的角度项目正常工作,$ P $。
But, it is preffered to convert your jquery plugins to a directive in order for them work properly in your angular project.
这篇关于AngularJS NG-视图不加载JS的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!