$routeParams and app initialisation with a deep link

202 views
Skip to first unread message

Bretto

unread,
May 25, 2012, 1:56:10 AM5/25/12
to ang...@googlegroups.com
When I start my app (a basic slide show) with a deep link: "ng-slides/index.html#/slides/0" 
My SlideCtrl gets the slideIdx but the MainCtrl doesn't... both controllers have $routeParams injected though. My route is pointing to $routeProvider.when('/slides/:slideIdx', {template: 'partials/slide-viewer.html', controller: SlideCtrl});
Does this mean that you can only get the slideIdx from the controller that is linked to that route or is this a bug ?

Bretto

unread,
May 25, 2012, 7:35:23 PM5/25/12
to ang...@googlegroups.com
I was thinking that $routeParams was a singleton and if so this is probably a bug....

Renan T. Fernandes

unread,
May 25, 2012, 10:58:20 PM5/25/12
to ang...@googlegroups.com
a fiddle showing the bug help a lot ;)

2012/5/25 Bretto <sep...@gmail.com>
--
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/-/vdb9G9w417kJ.

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.



--
Renan Fernandes(aka "ShadowBelmolve")

Bretto

unread,
May 25, 2012, 11:17:01 PM5/25/12
to ang...@googlegroups.com
How do you simulate deep link with fiddle ?


On Friday, 25 May 2012 15:56:10 UTC+10, Bretto wrote:

Bretto

unread,
May 26, 2012, 1:53:24 AM5/26/12
to ang...@googlegroups.com
It appears to be a race condition... a controller with $routeParams may be initialise by Angular before $routParams is configured with the data... 

Bretto

unread,
May 27, 2012, 9:18:16 AM5/27/12
to ang...@googlegroups.com
Is this a bug or the expected behaviour ? As the sole purpose of $routeParams ( from my limited understanding ) is to provide its params, I am thinking that any controller requesting $routeParams dependency should be initialised only once $routeParams is configured... 

Peter Andreas Molgaard

unread,
May 28, 2012, 3:36:44 AM5/28/12
to ang...@googlegroups.com
I'm happy to have read this post, as I share the understanding of $routeParams with Bretto...
Reply all
Reply to author
Forward
0 new messages