1

I'm having trouble with this situation: I have a block of jQuery code that I need to load using ng-bind-html into a span element. This element only get shown when a tab is selected so the span is doing ng-show="activetab===2"

So I stick the jQuery in a variable called content and I use ng-bind-html="content" and if I just set that variable to be some plain words like "Jonny play soccer" it fine, but if I change it to a big chunk of javascript, it just displays right when the page is loaded, even before the activetab is set to 2.

I will paste the Javascript below too. It's a plugin called Flexpaper that displays a PDF.

<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'
                    }}
            );
        });

Cocorico
  • 2,319
  • 3
  • 22
  • 31

0 Answers0