2

Is there any way to include only relevant js files for a single route, using angularjs? So not putting all includes into index.html, but call only user.js on /user route.

Something similar like calling css here How to include view/partial specific styling in AngularJS

That way I can optimise my app to have only necessary files on each route.

Thank you, Marko

EDIT 1) I'm using something like this Angular controller not loading using OcLazyLoad and ngRoute, if I have time, I will put on bitbucket later so that all can use it :D

Community
  • 1
  • 1
Arcagully
  • 364
  • 1
  • 3
  • 13
  • 1
    Maybe creating a custom directive like [link](http://odetocode.com/blogs/scott/archive/2014/04/08/dynamically-injecting-script-tags-with-angularjs.aspx) would work. – AndreaM16 May 22 '15 at 14:47
  • This is looking creative :) I also ask other for people to give me their suggestions and will put best solution in edit for others to see it :) thx man – Arcagully May 22 '15 at 14:52
  • Not an answer to your question, per se, but if you optimize your js files (bundle, minify), you may find that an acceptable solution to optimizing your app. – mellis481 May 22 '15 at 15:09

0 Answers0