我正在新页面上创建一个动态角度元素,如下所示
的index.html
var openPrint = window.open('/acImageViewer/html/imageLibraries.html');
openPrint.onload = function() {
var doc = openPrint.document;
$(doc.body).html('<jqyiviewer class="filter_icon_ul viewerHeight" id="acImgViewer" src="http://www.wellclean.com/wp-content/themes/artgallery_3.0/images/car3.png" align="centre" width="auto" height="500" data="data"></jqyiviewer>');
};
这将打开一个新页面,其中我的库,指令和css加载如下(imageLibraries.html)
<html ng-app="acIViewerApp">
<head>
<meta charset="utf-8">
<title>Image viewer</title>
<link href="/acImageViewer/css/kendo.common.min.css" rel="stylesheet">
<link href="../css/new_kendo.css" rel="stylesheet">
<link href="../css/jquery.iviewer.css" rel="stylesheet">
<link href="../css/style.less" rel="stylesheet/less">
<script type="text/javascript" src="../libs/angular.min.js"></script>
<script type="text/javascript" src="../libs/less.js"></script>
<script type="text/javascript" src="../libs/jquery-1.8.3.min.js"></script><!--JQuery library-->
<script src="../libs/jquery-ui.min.js"></script><!--Jquery library -->
<script src="../libs/acImageViewer.js"></script><!--JQuery library for Imageviewer-->
<script src="../libs/kendo.all.min.js"></script><!--For Kendo Functionality -->
<script src="../libs/jquery.mousewheel.js"></script><!--JQuery library for use mouse event-->
<script src="../js/app.js"></script>
<script src="../js/directives/directives.js"></script><!--directive for iviewer-->
</head>
<body>
</body>
</html>
正在index.html中动态生成正文。 问题是指令.js没有替换jqyiviewer标签。
我在index.html中使用相同的标签,这里一切正常。
我猜测我的directive.js被加载并编译第一个,之后标签被插入,所以它不会替换它。