I am using Angular 4 for my web template. HTML is generated once the HTTP get method is called inside the constructor, the response of which creates the HTML.
The above works fine.
I am also using jQuery with Angular and trying to initialize a function on this page.
$(function() {
Books.init();
});
I have tried calling the above code inside various lifecycle hooks. For example, ngOnInit(), ngOnChanges(), ngDoCheck, ngAfterViewInit(), ngAfterContentInit() but still the code gets called before the view is completely rendered by the API response.
Is there any way to get an event which assures that the view is completely rendered and then I can load my jQuery?
Please note: I have called this function inside a setTimeOut call with a small time delay and this works in that.