0

I am at the beginner stage in angular 2 . In my angular 2 Single page application i have no. of script and css files to be load in one of my component.

Now when i open that component view in browser , it loads all files at head of html page and working well , But after that when i open other views, all css, js files are still present at there ,which is making slow down my application.

I need to unload these component specific files(js,css) when i switch to another views of application.

Is there any way or option in angular 2 , please suggest best one .

1 Answer 1

1

Use lazy loading to load the feature modules as required.

https://angular.io/docs/ts/latest/guide/ngmodule.html#!#lazy-load

Sign up to request clarification or add additional context in comments.

Comments

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.