WkHTMLtoPDF没有加载Angular

时间:2017-11-03 20:00:15

标签: angularjs angularjs-directive wkhtmltopdf

我正在研究Angular 1.5.8和WkHTMLtoPDF 0.13.0 alfa。 我在Windows中使用以下参数从cmd运行WkHTMLtoPDF:

wkhtmltopdf --user-style-sheet 
file:///C:\Users\joha\MyProject\public\css\print.css --enable-local-file-
access   --javascript-delay 8000
"http://localhost:9000/print="X"&code="code"&token="XXX"&user=user1"  
C:\tmp\testPrint.pdf

此网址调用Scala服务,该服务返回: 好的(views.html.myView(javascripts,request.getQueryString(" code")。getOrElse(" No error repeived"),token,objectType))。withSession(" user" - > Json.toJson(tL).toString())

在myView.html中,我使用自己的Angular指令,名为print-canvas,它拥有自己的控制器

@(javascripts: Seq[String], code:String, token:String, objectType:String)
<html ng-app="visioanris_ui">
    <head>
        @includes()
    </head>

    <body>
        <script src='/angular/lib/jquery/jquery.min.js'></script>
        <print-canvas code="@code" token="@token" object-type="@objectType">
        </print-canvas>

        <h2>CODE: @code</h2>
        <h2>TOKEN: @token</h2>
        <h2>OBJECT TYPE: @objectType</h2>

    </body>
    @for(script <- javascripts) {
    <script src='@routes.Assets.versioned(script)' type="text/javascript">
    </script>
    }
</html>

我的问题是print-canvas指令控制器不起作用。 有人知道为什么WkHTMLtoPDF没有看到print-canvas控制器? 我说WkHTMLtoPDF没有看到我的控制器因为我在构造函数printCanvasController中调用了一个服务而且这个服务从未被调用过,但如果我在chrome中运行我的服务,则调用printCanvasController构造函数

我的print-canvas指令是:

directivesModule.directive('printCanvas', ['$compile',
(@$compile) ->
    restrict: 'AE'
    transclude:true
    scope:{
        code:"=code"
        token:"=token"
        objectType:"=objectType"
    } 
    controllerAs: 'me'
    controller: 'printCanvasController'
   templateUrl: 
   '/assets/partial/directives/printDirective/analysisPrintView.html'
   ])

提前致谢。

0 个答案:

没有答案