Skip to content
This repository has been archived by the owner on Oct 6, 2022. It is now read-only.

Using the window.renderComplete in Angular 6 #226

Closed
francisaguilar21 opened this issue Oct 5, 2018 · 1 comment
Closed

Using the window.renderComplete in Angular 6 #226

francisaguilar21 opened this issue Oct 5, 2018 · 1 comment

Comments

@francisaguilar21
Copy link

Hi,

Sorry for the silly question but I have been researching for hours now on how to implement that call in Angular. I tried inserting it inside one of my components but I don't think it seems to work since it doesn't appear in the list of scripts in the elements tab of my Chrome DevTools.

Here's a picture that shows the script tag isn't being included.

capture

I inserted the tag this way:

---- sample.component.html ----
<script type="text/javascript"> window.renderComplete = hasRendered; </script>

---- sample.component.ts ----
export class SampleComponent {
ngOnInit() {
this.route.params.subscribe((params) => {
this.eventId = params['eventUrl'];
this.organizerUrl = params['partnerUrl'];
this.eventService.getEvent(this.eventId).then(event => {
this.initializeEventData(event);
this.hasRendered = true;
});
});
}
}

@Romanchuk
Copy link

Why do you insert <script> tag instead of set renderComplete in your code?

this.eventService.getEvent(this.eventId).then(event => {
    this.initializeEventData(event);
    window.renderComplete = true
});

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

No branches or pull requests

3 participants