I have a website written with Angular and I want to use the DearFlip jQuery plugin to read PDF files as flipbooks.
I have tried to include the plugin in my application's index.html like so:
I added the script source in index.html. It works fine when I put this line in index.html:
<div id="flipbook" class="_df_book" source="assets/pdf/assouka_mag.pdf">pdf</div>
But it doesn't work when I try to use it in a component which was loaded by <router-outlet>.
Why not? How can I achieve this?


Try contacting their support as it's a paid product.
As you did not attach any errors or details that would help understanding what "doesn't work" actually means, I would guess that plugin inits before the content appears on the page.
jQuery plugins are usually meant for static websites. This means that they self-intialize when a page is loaded and it has all the required HTML elements in place upon load. This is not the case for SPAs, because when the scripts are loaded there is no HTML at the time. Therefore, all the initialization doesn't pick anything up.
I did not find in the documentation any functions to init at a specific time. This is what you would want to do in Angular. When the page is initialized and has rendered its content
ngAfterViewInitcall this plugin intialization hook.Another solution would be to stick with Angular-centric or pure JS libraries. jQuery doesn't go well with Angular. If it's possible to find Angular library - stick with it. Fallback to JS libraries as they require less code to work (as they don't depend on jQuery) and usually have API which allows for some customizations.