Can I replace a target.url observer?


#1

I have code like this in my application controller:

    // eslint-disable-next-line ember/no-observers
currentPathObserver: observer('target.url', function() {
    this.set('isSearch', false);
}),

The isSearch property is used to show / hide a liquid container. Is there a better way to do this, eventually without an observer?


#2

You can use currentRouteName by injecting the router in the component that shows the liquid container but you still need an observer I think. See also: