如何在ng绑定html中正确包含jQuery?(不会隐藏)
这种情况下我遇到了麻烦:我需要使用ng bind html将一块jQuery代码加载到span元素中。此元素仅在选择选项卡时显示,因此范围正在执行ng show=“activetab==2” 因此,我将jQuery插入一个名为content的变量,并使用ng bind html=“content”如果我只是将该变量设置为一些简单的单词,如“Jonny play soccer”,则效果很好,但如果我将其更改为一大块javascript,则在加载页面时它会正确显示,甚至在activetab设置为2之前 我也将粘贴下面的Javascript。这是一个名为Flexpaper的插件,可以显示PDF如何在ng绑定html中正确包含jQuery?(不会隐藏),jquery,angularjs,ng-hide,flexpaper,Jquery,Angularjs,Ng Hide,Flexpaper,这种情况下我遇到了麻烦:我需要使用ng bind html将一块jQuery代码加载到span元素中。此元素仅在选择选项卡时显示,因此范围正在执行ng show=“activetab==2” 因此,我将jQuery插入一个名为content的变量,并使用ng bind html=“content”如果我只是将该变量设置为一些简单的单词,如“Jonny play soccer”,则效果很好,但如果我将其更改为一大块javascript,则在加载页面时它会正确显示,甚至在activetab设置为2之
<div id="documentViewer" class="flexpaper_viewer" style="position:absolute;left:10px;top:10px;width:800px;height:500px"> </div>
<script type="text/javascript">
function getDocumentUrl(document){
return "php/services/view.php?doc={doc}&format={format}&page={page}".replace("{doc}",document);
}
var startDocument = "Paper";
jQuery.get((!window.isTouchScreen)?'UI_flexpaper_desktop_flat.html':'UI_flexpaper_mobile.html',
function(toolbarData) {
jQuery('#documentViewer').FlexPaperViewer(
{ config : {
SWFFile : 'docs/Paper.pdf.swf',
IMGFiles : 'docs/Paper.pdf_{page}.png',
JSONFile : 'docs/Paper.js',
PDFFile : 'example.pdf',
Scale : 0.6,
ZoomTransition : 'easeOut',
ZoomTime : 0.5,
ZoomInterval : 0.2,
FitPageOnLoad : true,
FitWidthOnLoad : false,
FullScreenAsMaxWindow : false,
ProgressiveLoading : false,
MinZoomSize : 0.2,
MaxZoomSize : 5,
SearchMatchAll : false,
Toolbar : toolbarData,
BottomToolbar : 'UI_flexpaper_annotations.html',
InitViewMode : 'Portrait',
RenderingOrder : 'html5,flash',
StartAtPage : '',
ViewModeToolsVisible : true,
ZoomToolsVisible : true,
NavToolsVisible : true,
CursorToolsVisible : true,
SearchToolsVisible : true,
UserCollaboration : true,
CurrentUser : 'Test user',
WMode : 'window',
localeChain : 'en_US'
}}
);
});
函数getDocumentUrl(文档){
返回“php/services/view.php?doc={doc}&format={format}&page={page}”;
}
var startDocument=“纸张”;
jQuery.get((!window.isTouchScreen)?'UI\u flexpaper\u desktop\u flat.html':'UI\u flexpaper\u mobile.html',
函数(工具栏数据){
jQuery(“#documentViewer”).FlexPaperViewer(
{config:{
SWFFile:'docs/Paper.pdf.swf',
IMGFiles:'docs/Paper.pdf{page}.png',
JSONFile:'docs/Paper.js',
Pdfile:'example.pdf',
比例:0.6,
ZoomTransition:“easeOut”,
缩放时间:0.5,
ZoomInterval:0.2,
FitPageOnLoad:对,
FitWidthOnLoad:false,
FullScreenAsMaxWindow:错误,
渐进加载:false,
minzoomize:0.2,
MaxZoomSize:5,
SearchMatchAll:false,
工具栏:工具栏数据,
底部工具栏:“UI_flexpaper_annotations.html”,
InitViewMode:'纵向',
渲染顺序:“html5,flash”,
起始页:“”,
ViewModeToolsVisible:true,
ZoomToolsVisible:对,
导航工具可视:对,
CursorToolsVisible:对,
SearchToolsVisible:对,
用户协作:是的,
CurrentUser:'测试用户',
WMode:'窗口',
localeChain:“恩_我们”
}}
);
});
初始化插件的方法是使用指令
ng bind html
来包含部分,我相信JS不会解析此代码,因此不会执行它charlietfl:在这种情况下应该可以工作吗?尝试但有困难。/初始化插件的方法是使用指令ng bind html
,用于包含部分,我相信JS不会解析此代码,因此不会执行它。charlietfl:在这种情况下应该可以吗?努力但有困难/