First of all, you shouldn't implement a logic according to the current route in a component. Your components should not be aware of the route they are been placed. But of course there may some exceptional cases, such as breadcrump components, menu components...
Anyway, the answers of your question are:
- By using
application controller
:
application controller
has a currentRouteName
property.
You can use application controller
such as:
Ember.getOwner(this).lookup('controller:application').get('currentRouteName')
- By using
router
:
Either inject the private -router
service to your component or lookup for the router instance such as:
Ember.getOwner(this).lookup('router:main').get('currentRouteName');