ocombe / ocLazyLoad

Lazy load modules & components in AngularJS
https://oclazyload.readme.io
MIT License
2.63k stars 510 forks source link

Question: Why reject and not resolve promise for already loaded file? #316

Open nkanand4 opened 8 years ago

nkanand4 commented 8 years ago

What is the reasoning behind rejecting a promise with the error Error: no file to load has been found, if you're trying to load an existing module you should use the 'inject' method instead of 'load'." if the file or files are already loaded? Why did you choose not to resolve it?

ocombe commented 8 years ago

Because it usually means that there is a problem with your code. If it's what you really want, you can add an error callback to your promise to catch the rejection.