App.router.currentState is gone / harder to use in RCs; replacement?


#1

Something that I loved in the 0.9.8 series was using App.router.currentState and its name and currentPath properties to get the router state and then do something simple with it. A basic example might be to keep track of breadcrumbs or “where am i.”

I have not found this same datum (easily) anywhere in RC6. I eventually did find a way to get at it but it was so buried and convoluted that, it seems to me, the core is signaling don’t do this.

As a practical example consider a view with

<div {{bindAttr class="isCurrent"}}>
 etc
</div>

and

isCurrent: function() {
  App.router.currentState.get('path') === this.get('myPath');
}.property()

Not compiled and tested code

So my questions are:

  1. Is the obfuscation of this datum intentional
  2. Should I be using a different access pattern?
  3. Is anyone doing anything like this successfully?

Thanks

Steven


#2

You can use the currentPath property on the ApplicationController. See this link.