Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ng=If and possible memory issues #122

Closed
donovan-duplessis opened this issue Apr 22, 2016 · 4 comments
Closed

Ng=If and possible memory issues #122

donovan-duplessis opened this issue Apr 22, 2016 · 4 comments

Comments

@donovan-duplessis
Copy link

donovan-duplessis commented Apr 22, 2016

Hey,

I have a generate button to generate a dynamic pdf and display it on my page. I can re-generate many times. I use the following:

<ng-pdf template-url="views/partials/pdf/statement.html" scale="page-fit" page="{{ page }}" ng-show="file!==null && !errored && !loading"></ng-pdf>

I think the ng-show (I totally stand under correction here) is not destroying the component properly when I re-generate. If I generate too many times, it starts taking very long to render the pdf; it starts rendering piece by piece from the top down. I noticed when I used the page on my phone, after a few generates, eventually when I closed down the browser, my phone hung for a while before responding again.

I think I could have a memory leak of sorts. This makes me think I need ng-if instead of ng-show so that the scope can be destroyed. Yet when I use ng-if the directive doesn't ever display? Maybe I am way off track here which is highly likely.

In my mind I need to have it destroyed before I re-generate the next PDF.

Any ideas would be greatly appreciated,
Donovan

@dennybiasiolli
Copy link
Collaborator

Hi @donovan-duplessis ,
I think ng-if is destroying the DOM portion of the directive, so the canvas is no longer linked with the directive.
Do you have the same problem with the latest version of angularjs-pdf?

@smallbitt
Copy link

Hi,
I'm having same issue with ng-if, at first my pdf get opened, at second I get just blank page.
if I take ng-if directive off (I'm using a modal window) then I get "Cannot read property 'getContext' of null" error..
an ideas to make it work?

@simobasso
Copy link
Collaborator

@smallbitt can you provide a simple jsfiddle?

@simobasso simobasso added bug and removed question labels Jan 3, 2017
@simobasso
Copy link
Collaborator

closed for lack of response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants