Open dramentol opened 6 years ago
Hmm, good catch. This is because we are caching script loaders by their url. But it looks like we should also care targetElement
and even attributes
parameters while we are checking cache. A PR will be very welcome or I'll try to fix this when I find some time next week.
Not sure about that. If you cache by url + target element you run the risk of multiple loads for the same script.
I don't see any reason to cache failed loads.
Hi,
Let's say I call loadScript for a url and a target element A and it fails. Then I call again for the same url but target element B. In this case, the script gets appended to element A. And element A may not even be in the dom anymore.
This happens for example when using ngx-script-loader component in a component.
My workaround is to delete the entry from scriptsLoaders map on error.