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

3
  • 1
    Maybe creating a custom directive like link would work. Commented May 22, 2015 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 Commented May 22, 2015 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. Commented May 22, 2015 at 15:09

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.