The DocumentViewer for Angular is created as a singleton instance on a page. Therefore, the complete control must be re-initialized explicitly when loading a partial view a second time. In Angular, "partial views" are implemented through routes. In this sample, two routes are implemented:

Loading...

The component home and textcontrol are navigated through links on the main app page:

Loading...

Due to the nature of Angular routes, the page is not reloaded when clicking on the navigation links, but a partial views is loaded dynamically into the DOM.

In this case, the DocumentViewer instance needs to be initialized explicitly by calling the init method. In the above code, the (click) event is used to call the initializeViewer method.

Loading...

This way, a new partial view can be loaded and reused including the DocumentViewer.