# \[Guide\] Require empty check?

**URL:** https://discuss.emberjs.com/t/guide-require-empty-check/9726
**Category:** Uncategorized
**Created:** [February 9, 2016, 7:54pm UTC](https://discuss.emberjs.com/t/guide-require-empty-check/9726 "2016-02-09T19:54:01Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![pcjpcj2](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/pcjpcj2/32/9702_2.png) [@pcjpcj2](https://discuss.emberjs.com/u/pcjpcj2)
#### Post date: [February 9, 2016, 7:54pm UTC](https://discuss.emberjs.com/t/guide-require-empty-check/9726/1 "2016-02-09T19:54:01Z")

</div>

I am following ember.js 2.3.0 guide.

now I read and code autocomplete method.

> **[Building a Complex Component - Tutorial - Ember Guides](https://guides.emberjs.com/v2.3.0/tutorial/autocomplete-component/)**
>
> As they search for a rental, users might also want to narrow their search to a specific city. Let's build a component that will let them filter rentals by city. 
> 
> To begin, let's generate our new component. We'll call this component list-filter,...

In this page, **app/controller/index.js** make undefined error when empty input string.

I don’t want to leave it.

So.

is it right code to solve? I find Ember.isEmpty().

```javascript
export default Ember.Controller.extend({
  filteredList: null,
  actions: {
    autoComplete(param) {
      if(param !== "") {
        this.store.query('rental', {city: param}).then((result) => {
          this.set('filteredList',result);
        });
      }
      else {
        let filteredList = this.get('filteredList');
        if(Ember.isEmpty(filteredList)) {
          return;
        }
        console.log();
        this.set('filteredList').clear();
      }
    },
    search(param) {
      if(param !== "") {
        this.store.query('rental', {city: param}).then((result) => {
          this.set('model',result);
        });
      }
      else {
        let model = this.get('model');
        if(Ember.isEmpty(model)){
          return;
        }
        this.set('model').clear();
      }
    }
  }
});

```

I want to know someone who have elegant solution.

---

<div class="post-metadata">

### Author: ![Sarath](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/sarath/32/12009_2.png) [@Sarath](https://discuss.emberjs.com/u/Sarath)
#### Post date: [February 13, 2016, 10:00am UTC](https://discuss.emberjs.com/t/guide-require-empty-check/9726/2 "2016-02-13T10:00:03Z")

</div>

Empty checks can be done with Ember.isEmpty() or Ember.isBlank()

Where Ember.isEmpty returns false for ({}) and isBlank will return true. So while handling objects try to use isBlank method

---

<div class="post-metadata">

### Author: ![pcjpcj2](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/pcjpcj2/32/9702_2.png) [@pcjpcj2](https://discuss.emberjs.com/u/pcjpcj2)
#### Post date: [February 13, 2016, 1:16pm UTC](https://discuss.emberjs.com/t/guide-require-empty-check/9726/3 "2016-02-13T13:16:50Z")

</div>

Thanks @Sarath 🙂

I’ll try `Ember.isBlank()`
