Print a div using javascript in angularJS single page application

前端 未结 7 1012
野性不改
野性不改 2020-11-28 02:44

I have a single page web application using angularJS. I need to print a div of certain page. I tried the following:

The page contains few div (print.html)

         


        
7条回答
  •  悲&欢浪女
    2020-11-28 03:35

    I don't think there's any need of writing this much big codes.

    I've just installed angular-print bower package and all is set to go.

    Just inject it in module and you're all set to go Use pre-built print directives & fun is that you can also hide some div if you don't want to print

    http://angular-js.in/angularprint/

    Mine is working awesome .

提交回复
热议问题