tl;dr: How to fix this: http://emberjs.jsbin.com/pazece/4/edit ?
I need to dynamically change routeName
of link-to helper. The motivation here is to create back button in bread-crumb navigation.
Problem arrises when my application transitions from route having one dynamic segment to route with multiple dynamic segments. This results in multiple #if
statements, because #link-to
cannot accept variable number of dynamic segments. SO example.
I can fix that by adding multiple #if
statements. Not nice, but in theory it works. Problem is that #link-to
routeName
property is recalculated before #if
statement can apply and wipe out that link from displaying. So Ember crashes on:
Uncaught Error: You didn't provide enough string/numeric parameters
to satisfy all of the dynamic segments for route bar
Above example is not my complex back-button code. Just stripped example.
If you are interested in multiple #if workaround that looks awful see here.
http://jsbin.com/rapevaditi/edit?html,js,output