-
Notifications
You must be signed in to change notification settings - Fork 58
Any chance this could be extended for filters and services? #7
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
Comments
Probably not the cleanest approach, but I just created lazy-filters and services much like what was done with directives. |
I'd like to see what you have done - would you consider forking this and adding it to show ? (or a pull request maybe ?) |
To add something to the discussion... the other day I was thinking about something like this: routeProvider.when('/view2', routeConfig.config({
controller: "controllers/myController",
filters: ["filters/filter1", "filters/filter1"]
services: [...]
directives: [...]
})) so you could basically define whatever you want for your view. This could be even done via json file as an external configuration. The other idea... what if your controller could define the dependencies using require plugins, like: define("controller", [
"service!./myService",
"directive!./myDirective"
], function () {
// the one thing that I don't like about the idea is that it
// mixes view and controller dependencies...
}) ... just thinking out loud ;) |
I like the second concept - as it seems a bit off to me that a 'router' is what wires up all the dependencies - whereas if a controller is using a service, then what you have feels right to me. I don't mind the view/controller - as I tend to always associate a controller to a view (perhaps I have a more MVVM perspective) |
Made a pull request. Hope it works for you guys. There's still work here to be done... |
@matys84pl, I've actually been using something similar to your first idea, with the routes being defined in an array, then passed into a router module all together for it to handle registering them. It seemed nice at first, but as we've built up a larger number of more complex routes, having all of the dependencies defined in two separate files (the route config and controller module) has proven cumbersome. You're second idea is intriguing though, and I think the problem of having dependencies defined in two such desperate places outweighs defining the view and controller dependencies together. We could still separate them with comments. :) |
Just reliving this issue, i would feel more comfortable with the second approach: define("controller", [
"service!./myService",
"directive!./myDirective"
], function () {
// the one thing that I don't like about the idea is that it
// mixes view and controller dependencies...
}) Because it would make me able to strictly specify my controller dependencies, my only thought about is that the directives should go on the |
Your solution so far is wonderful for us. Thanks for making it open!
The text was updated successfully, but these errors were encountered: