Skip to content
This repository has been archived by the owner on Feb 9, 2024. It is now read-only.

EXCEPTION: Cannot read property 'src' of null #369

Open
arjenbrandenburgh opened this issue Jan 10, 2017 · 3 comments
Open

EXCEPTION: Cannot read property 'src' of null #369

arjenbrandenburgh opened this issue Jan 10, 2017 · 3 comments

Comments

@arjenbrandenburgh
Copy link

arjenbrandenburgh commented Jan 10, 2017

Using Postscribe in combination with Angular2.

In my current project I'm looking to get a table from an external javascript file that contains a document.write. In the past we've done that in this fashion:

<script src="http://url.to.external.domain.com/file.ashx?sid=<ID>" type="text/javascript"></script>

Angular2 removes script tags from templates, so that is not a solution. I've used postscribe and that worked when Angular2 was still in RCs. At some point I suddenly noticed it stopped working, and can't trace back what package broke it.

I now get this error:
stacktrace

The afterWrite callback still fires and the document.write in the external JS file has been written, but the done callback won't fire anymore. Since I'm working with an Angular2 SPA, the postscribe call won't happen again when opening a similar page, since it produced an error.

I've tried many things, but simply don't know what causes this. Was hoping anyone could help.

Plunkr: http://plnkr.co/edit/FHSVKDL2rv8TAQyTeqE2?p=preview
You can see it's working, but in the console you see the same errors described above.

@ghost
Copy link

ghost commented Jan 14, 2017

I ran into the same issue. Downgrading to v2.0.6 worked for me.

@arjenbrandenburgh
Copy link
Author

arjenbrandenburgh commented Jan 16, 2017

@ghost's suggestion to downgrade to v2.0.6 indeed seems to have solved my problem.

Thanks. Leaving the issue open, since it still seems it should be fixed at some point.

@giannoudak
Copy link

Do you have any estimation on when this is going to be fixed?
Thanks in advance

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

2 participants