--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To view this discussion on the web visit https://groups.google.com/d/msg/angular/-/RLQeHNFG9ksJ.
To post to this group, send email to ang...@googlegroups.com.
To unsubscribe from this group, send email to angular+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/angular?hl=en.
--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To view this discussion on the web visit https://groups.google.com/d/msg/angular/-/YampgreN1h8J.
You can also access the current route with "$route.current" if you inject $route into your controller.
Hi Nick,Running into similar issue with subsections. Could you share some code on how you were able to do this?Thanks
For what it's worth, I'm finding myself in a similar place to Nick R. (That's how I found this old thread.)I have a controller that handles several tabs worth of data that is handled by one controller. I'd love to have each tab change the path of the url (so they're easily sharable/bookmarkable), but I don't want to have the screen flicker while the same data is loaded by a new instance of the same controller.Is it by chance now possible to do so?
I was playing around with $route today and with the reloadOnSearch:false feature and I found it pretty useful. In fact, I even went so far as to alter my copy of Angular to set reloadOnSearch:false for all routes. That way I could put a bunch of neat global mode-switching features into the url via $location.search and handle them in the $on '$routeChange' handler on the root controller. The sort of features I targeted here were fullscreen and other viewing preferences that affected the application no matter what you were looking at. Implementing them on the root controller kept me from having to touch every controller or every route with this information.The downside of this is that my urls don't look as good with all those querystring arguments in them. And that got me thinking -- why can't other routing information work the same way reloadOnSearch does? What if, if you changed $location.path in such a way that didn't end up changing the current controller, you could have it call $on '$routeChange' with the new routing variables instead of destroying and re-creating the controller?Another big reason why I started using reloadOnSearch:false is so that my inner scrollable content wouldn't be jumped back to the top every time I wanted to change the url. For example, if you were scrolling through a sidebar and picking out items that altered the url, it would be frustrating if that sidebar kept scrolling back to the top. Using querystring arguments here looks even uglier than it does with global features though.While I'm on the subject of routing, it would be really nice if you could specify some extra parameters to be passed along in the route params for a controller. The situation I keep getting into is this one:$route.when('/specific_section/specific_subsection', controller:SpecialController);$route.when('/specific_section/specific_subsection_2', controller:SpecialController);$route.when('/:section/:subsection', controller:DefaultController);Here I am trying to re-use SpecialController for two special cases to my default routing. Unfortunately, I have no way of knowing which special case was chosen, since it doesn't pass on the section and subsection variables that the default controller does. If controller inheritance was a thing, I could create two different controllers that both inherited the behavior of SpecialController so I wouldn't have to repeat it. But currently it seems like SpecialController has to re-parse the url to figure out where it is, or perhaps I have to copy-paste it to create both versions. This problem could also be solved by allowing regular expression captures in routes, as that would let me restrict when this controller was used but still pass along the information I matched against.
--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+u...@googlegroups.com.
Visit this group at http://groups.google.com/group/angular?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.
This is not a bad idea!
Pete
...from my mobile.