Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Best way to lazy load a service used in multiple controllers using ocLazyLoad? #408

Open
FarhanAbdulQayyum opened this issue Oct 5, 2017 · 1 comment

Comments

@FarhanAbdulQayyum
Copy link

FarhanAbdulQayyum commented Oct 5, 2017

I can lazy load a controller file in routing. So that controller file is loaded when its needed.
but I want to know what is the best way to lazy load service file which is being used in multiple controllers?

As loading a single service file in resolves of multiple states will cause lots repetition of code.

Like this I have many common services which are needed in many places and loading all of them in index file will make system loading slow at first.

@piller187
Copy link

Perhaps you could bundle the service names array to be returned in a couple functions and then use that in the resolve to reduce the duplication so if a service names changes or whatever you can just change it in the function instead of all the routes?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants