# Managing query parameters in controller within input

**URL:** <https://discuss.emberjs.com/t/managing-query-parameters-in-controller-within-input/12928>\
**Category:** Learning Team\
**Created:** [May 5, 2017, 8:35pm UTC](https://discuss.emberjs.com/t/managing-query-parameters-in-controller-within-input/12928 "2017-05-05T20:35:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![armikhalev](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/armikhalev/32/12992_2.png) [@armikhalev](https://discuss.emberjs.com/u/armikhalev)\
**Post date:** [May 5, 2017, 8:35pm UTC](https://discuss.emberjs.com/t/managing-query-parameters-in-controller-within-input/12928/1 "2017-05-05T20:35:02Z")

</div>

I was following [this tutorial](https://www.foraker.com/blog/creating-a-better-search-experience-with-ember) to get input in a language translation app updating URL, something like Google Translate does. But I don’t want every letter in the input box to be bound with URL, because user wouldn’t want to go by one letter back if he/she clicks the browser back button, better user experience would be if he/she goes to the previous word by one click - and that is what I am trying to achieve.

What have I tried: I added separate ‘value’ computed property which gets value from another ‘search’ property. Better to show code snippet:

```
export default Ember.Controller.extend({
     queryParams:['search'],
     search:"",
     value: Ember.computed('search', function(){
         return this.get('search');
      }),
     actions: {
        filterByWord(param) {
        ...
         if (param.length === 1) {
            this.setProperties({search:param});
         }
        ... 
     } 
});

```

Then in template:

`{{input value=value}}`

I omitted the details but essentially, now if a user goes to the URL like “[http://translator/english?word=ember](http://translator/english?word=ember)”, my app will render the word and trigger the action giving the search result. However, if I click the back button, though it goes back to the previous url, it doesn’t trigger the action and, as a consequence, doesn’t update the search, because ‘search’ is undefined on route change.

So my question is - what is the best, Ember way to make my ‘search’ parameter to be bound with URL, but having more control over the value which goes to the query parameters?

---

<div class="post-metadata">

**Author:** ![martletandco](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/martletandco/32/13089_2.png) [@martletandco](https://discuss.emberjs.com/u/martletandco)\
**Post date:** [October 21, 2017, 9:35am UTC](https://discuss.emberjs.com/t/managing-query-parameters-in-controller-within-input/12928/2 "2017-10-21T09:35:02Z")

</div>

Query params are a bit annoying, lucky clever people made a useful addon! [Ember Parachute](https://github.com/offirgolan/ember-parachute/blob/master/README.md) gives you a lifecycle style API to make dealing with query params and state much nicer (see [demo](https://offirgolan.github.io/ember-parachute/))

---

<div class="post-metadata">

**Author:** ![locks](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/locks/32/3878_2.png) [@locks](https://discuss.emberjs.com/u/locks)\
**Post date:** [October 23, 2017, 11:11am UTC](https://discuss.emberjs.com/t/managing-query-parameters-in-controller-within-input/12928/3 "2017-10-23T11:11:50Z")

</div>

Hi @armikhalev, what you have seems generally fine. You could look into doing something similar to [GitHub - poteto/ember-changeset: Ember.js flavored changesets, inspired by Ecto](https://github.com/DockYard/ember-changeset), as well.
