# EXCEPTION: Attempt to use a dehydrated detector

**URL:** <https://forum.ionicframework.com/t/exception-attempt-to-use-a-dehydrated-detector/51647>\
**Category:** ionic-v3\
**Created:** [May 10, 2016, 1:25pm UTC](https://forum.ionicframework.com/t/exception-attempt-to-use-a-dehydrated-detector/51647 "2016-05-10T13:25:25Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ghprod](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/ghprod/32/64643_2.png) [@ghprod](https://forum.ionicframework.com/u/ghprod)\
**Post date:** [May 10, 2016, 1:25pm UTC](https://forum.ionicframework.com/t/exception-attempt-to-use-a-dehydrated-detector/51647/1 "2016-05-10T13:25:25Z")

</div>

Hi

I’ve got some exception like this

```auto
EXCEPTION: Attempt to use a dehydrated detector: AuthPage_1 -> blur

```

Its happen when we use `Loading` before change rootPage, and in rootPage intially also make `Loading`

```auto
User click button > Loading > Loading.dismiss() > nav.setRoot(OtherPage) > OtherPage.onPageLoaded() > Loading > Loading.dismiss() > complete

```

Any idea? Thanks

**UPDATE**

I can confirm this exception occur when change rootPage from Observale \> Subscribe

```auto
this.auth.login(credentials)
            .subscribe(data => {
                loading.dismiss();

                console.log('auth success');

                this.nav.setRoot(DashboardPage);
            }, error => {
                loading.dismiss();

                console.log('auth error');
            }, () => {
                console.log('auth complete');
            })

```

If i remove `loading` part then everything is perfect …

---

<div class="post-metadata">

**Author:** ![allpref](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/allpref/32/99763_2.png) [@allpref](https://forum.ionicframework.com/u/allpref)\
**Post date:** [May 10, 2016, 3:37pm UTC](https://forum.ionicframework.com/t/exception-attempt-to-use-a-dehydrated-detector/51647/2 "2016-05-10T15:37:15Z")

</div>

I’ve had this problem a few times, and never a case was the same as another, so I do not know exactly how to solve for all. But every time I had the problem was due to the element no longer exists on the page, so sometimes change a \* ngIf to [hidden], or put a setTimeout resolved.

---

<div class="post-metadata">

**Author:** ![ghprod](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/ghprod/32/64643_2.png) [@ghprod](https://forum.ionicframework.com/u/ghprod)\
**Post date:** [May 10, 2016, 6:55pm UTC](https://forum.ionicframework.com/t/exception-attempt-to-use-a-dehydrated-detector/51647/3 "2016-05-10T18:55:51Z")

</div>

I’ve try with setTimeout, but still persist, its really strange, but its occur only on first time load ☹

---

<div class="post-metadata">

**Author:** ![xr0master](https://avatars.discourse-cdn.com/v4/letter/x/b4bc9f/32.png) [@xr0master](https://forum.ionicframework.com/u/xr0master)\
**Post date:** [May 10, 2016, 7:00pm UTC](https://forum.ionicframework.com/t/exception-attempt-to-use-a-dehydrated-detector/51647/4 "2016-05-10T19:00:53Z")

</div>

+1  
I have SAME 5 inputs and one of them doesn’t work )

I replaced ([ngModel]) to [value] and it works.  
After this I replaced [value] to ([ngModel]) and it works too  
Magic 🙂

---

<div class="post-metadata">

**Author:** ![xr0master](https://avatars.discourse-cdn.com/v4/letter/x/b4bc9f/32.png) [@xr0master](https://forum.ionicframework.com/u/xr0master)\
**Post date:** [May 11, 2016, 3:01pm UTC](https://forum.ionicframework.com/t/exception-attempt-to-use-a-dehydrated-detector/51647/5 "2016-05-11T15:01:28Z")

</div>

I found my problem. Used trackBy without unique key.

---

<div class="post-metadata">

**Author:** ![jonvargas](https://avatars.discourse-cdn.com/v4/letter/j/ad7895/32.png) [@jonvargas](https://forum.ionicframework.com/u/jonvargas)\
**Post date:** [May 16, 2016, 8:03pm UTC](https://forum.ionicframework.com/t/exception-attempt-to-use-a-dehydrated-detector/51647/6 "2016-05-16T20:03:56Z")

</div>

It my case, it only happens when I use `nav.setRoot` instead of `nav.push`

Failing code:

```
  onLogin(form) {
    if (form.valid) {
      this.menu.open();
      this.submitted = true;
      this.nav.setRoot(CreatePage); // fails
    }
  }

```

Working code:

```
  onLogin(form) {
    if (form.valid) {
      this.menu.open();
      this.submitted = true;
      this.nav.push(CreatePage); // works
    }
  }

```

How to solve this issue or create a workaround? I am not so skilled yet to understand what is going on behind the cameras.

---

<div class="post-metadata">

**Author:** ![xr0master](https://avatars.discourse-cdn.com/v4/letter/x/b4bc9f/32.png) [@xr0master](https://forum.ionicframework.com/u/xr0master)\
**Post date:** [May 16, 2016, 8:31pm UTC](https://forum.ionicframework.com/t/exception-attempt-to-use-a-dehydrated-detector/51647/7 "2016-05-16T20:31:38Z")

</div>

Try do the blur (unfocus) from all input elements. It must fix this issue.  
So this problem:  
Your form focused on any input. After blur, angular 2 runs the validation. When you use setRoot then you less focus =\> blur and then angular runs the validation but your form already isn’t exist. Pam pam! Error. IMO.
