Can I replace a target.url observer?

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?

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:

1 Like