question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Page changing issue when binding to page attribute

See original GitHub issue

When you bind to the page attribute with both a getter and setter like [(page)] the scrolling inside the PDF breaks and jumps to the page beginning whenever you come close to the new page on scrolling.

I tried to circumvent this behavior by not using this kind of binding but (pageChange) event instead. This works like using a (page) binding but I also want to be able to set the page number from the outside. Using [page] results in the same problem as described above because when the page change event is triggered on half on the scroll view of the new page, the page will jump to the new page. This prohibits smooth page scrolling.

I then tried to set the page attribute by ViewChild binding the ngx-extended-pdf-viewer component and setting the page like this:

@ViewChild('pdfComponent') private pdfComponent: NgxExtendedPdfViewerComponent;
...
this.pdfComponent.page = newPageNumber;

But this doesn’t affect any changes. It would be cool to have a setter that enables to set the PDF.js PDFViewerApplication.page attribute in order to change the page.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
stephanrauhcommented, Jul 13, 2020

Great! If I read your source code correctly, my idea was almost successful. That gives me hope I can solve the problem in the library itself.

Thanks for the hint!

0reactions
stephanrauhcommented, Jul 26, 2020

After publishing version 4.0.5, the bug should be gone. For some reason, it’s not possible to use both [(page)] and [(pageLabel)] at the same time. I’ve documented this in the showcase.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Model Binding in ASP.NET Core | Microsoft Learn
Provides the data to controllers and Razor pages in method ... or using a model binding attribute to configure binding avoids this issue:....
Read more >
Issues with binding multiple objects on a razor page
Posting the page back seems to clear some data on the parent (testRun) object on the page, but the data remains intact when...
Read more >
Model Binding in Razor Pages
Model Binding in Razor Pages is the process that takes values from an HTTP requests and maps them to Razor Pages PageModel properties...
Read more >
Binding syntax - Angular
Data binding works with properties of DOM elements, components, and directives, not HTML attributes.
Read more >
Binding Component Values and Instances to External Data ...
The page author has more control over the component attributes. ... You'll need to use a component binding only when you need to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found