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

resolving code outside of the app.js #1

Open
graphicsxp opened this issue May 7, 2013 · 2 comments
Open

resolving code outside of the app.js #1

graphicsxp opened this issue May 7, 2013 · 2 comments

Comments

@graphicsxp
Copy link

My understanding of the resolve plugin is, amongst other things, to be able to pull data from the server and delay the rendering and the execution of the controller until the promise has resolved. That's great and it seems to be something I need. But I have one problem with that. Having code to make a call to a service from the route definition in the app.js seems like a very bad place to do so.
Would there be a way to point the resolve property to some function elsewhere in the code (possibly in the controller itself, as it sounds like the most logical place to put it) ?

@ticky
Copy link

ticky commented Mar 2, 2014

@graphicsxp, did you ever find a good solution to this?

@graphicsxp
Copy link
Author

Yes, just create a function in your controlle's file (not in the controller itself) and assign this function to the resolve property of your route. Since you cannot use string arguments, you'll have issues during minification, but you can use $inject to inject parameters to your resolver.

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