# Problem with loading

**URL:** <https://forum.ionicframework.com/t/problem-with-loading/56830>\
**Category:** ionic-v3\
**Created:** [July 7, 2016, 6:55am UTC](https://forum.ionicframework.com/t/problem-with-loading/56830 "2016-07-07T06:55:49Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![piyukore](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/piyukore/32/102073_2.png) [@piyukore](https://forum.ionicframework.com/u/piyukore)\
**Post date:** [July 7, 2016, 6:55am UTC](https://forum.ionicframework.com/t/problem-with-loading/56830/1 "2016-07-07T06:55:49Z")

</div>

I have recently updated to beta 10, and since then Loading is creating problems.

Inside getFilters(): when I am calling loading before any modal the modal wouldn’t open, and the whole app gets stuck. when I remove the loding code snippet it would open without any problem

Here is the code i am refering to:

```
getFilters () {
    let loader = Loading.create({
        spinner: 'crescent',
        duration: 2000
    });
    this.nav.present(loader);
    let modal= Modal.create(Filter, {
      request: this.filterValue
    });

    this.nav.present(modal);

}

```

also tried dismissing the loader and then opening modal, still wouldn’t work ☹ It shows the error  
`TypeError: Cannot read property 'nativeElement' of undefined`  
modal would not open but later the app keeps working  
Is it something that I am doing wrong? why is it happening? Any ideas anyone?  
thanks in advance!

---

<div class="post-metadata">

**Author:** ![paunadeu](https://avatars.discourse-cdn.com/v4/letter/p/9de053/32.png) [@paunadeu](https://forum.ionicframework.com/u/paunadeu)\
**Post date:** [July 7, 2016, 10:06am UTC](https://forum.ionicframework.com/t/problem-with-loading/56830/2 "2016-07-07T10:06:13Z")

</div>

Try change:

```
this.nav.present(loader);

```

to:  
setTimeout(()=\>{  
this.nav.present(loader);  
});

---

<div class="post-metadata">

**Author:** ![piyukore](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/piyukore/32/102073_2.png) [@piyukore](https://forum.ionicframework.com/u/piyukore)\
**Post date:** [July 7, 2016, 10:12am UTC](https://forum.ionicframework.com/t/problem-with-loading/56830/3 "2016-07-07T10:12:52Z")

</div>

Thanks @paunadeu for your reply.

I tried that too …

Now just loader would work after a small time(ie, after event loop starts) but still modal was not opened.

---

<div class="post-metadata">

**Author:** ![paunadeu](https://avatars.discourse-cdn.com/v4/letter/p/9de053/32.png) [@paunadeu](https://forum.ionicframework.com/u/paunadeu)\
**Post date:** [July 7, 2016, 10:15am UTC](https://forum.ionicframework.com/t/problem-with-loading/56830/4 "2016-07-07T10:15:56Z")

</div>

> [@piyukore](#):
>
> Modal.create

If you try to debug this.filterValue before create the Model has any value?

console.log(this.filterValue) before let modal …

---

<div class="post-metadata">

**Author:** ![piyukore](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/piyukore/32/102073_2.png) [@piyukore](https://forum.ionicframework.com/u/piyukore)\
**Post date:** [July 7, 2016, 10:19am UTC](https://forum.ionicframework.com/t/problem-with-loading/56830/5 "2016-07-07T10:19:40Z")

</div>

filterValue is initialized on ngOninit  
and the values are changed based on user inputs and also inside the modal

---

<div class="post-metadata">

**Author:** ![paunadeu](https://avatars.discourse-cdn.com/v4/letter/p/9de053/32.png) [@paunadeu](https://forum.ionicframework.com/u/paunadeu)\
**Post date:** [July 7, 2016, 10:20am UTC](https://forum.ionicframework.com/t/problem-with-loading/56830/6 "2016-07-07T10:20:31Z")

</div>

Yes, but on console.log you got it?

---

<div class="post-metadata">

**Author:** ![piyukore](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/piyukore/32/102073_2.png) [@piyukore](https://forum.ionicframework.com/u/piyukore)\
**Post date:** [July 7, 2016, 10:22am UTC](https://forum.ionicframework.com/t/problem-with-loading/56830/7 "2016-07-07T10:22:17Z")

</div>

yea I’ve tested that … It is console logging both before and after of modal and also loader.

But modal is not opening

---

<div class="post-metadata">

**Author:** ![paunadeu](https://avatars.discourse-cdn.com/v4/letter/p/9de053/32.png) [@paunadeu](https://forum.ionicframework.com/u/paunadeu)\
**Post date:** [July 7, 2016, 11:24am UTC](https://forum.ionicframework.com/t/problem-with-loading/56830/8 "2016-07-07T11:24:11Z")

</div>

I implemented Modal without problems. It’s too hard to implement. You need to create class on same TS file.

In main class:  
populateChannels(){  
let modal = Modal.create(ZapContent, { canals: this.canals, tab: this.tab });  
this.nav.present(modal);  
}

//ZAP modal  
@Component({  
templateUrl: ‘build/pages/canals/canals.html’  
})

class ZapContent {  
public canals: any;  
public tab: any;  
constructor(private viewCtrl: ViewController, public params: NavParams, public nav:NavController) {  
this.canals = this.params.data.canals;  
this.tab = this.params.data.tab;  
[//console.log](https://console.log)(this.params.data.canals);  
}

```
itemTapped(event, canal) {
    this.nav.push(Channel, {
    canal: canal,
    tab: this.tab
    });
}

```

close() {  
this.viewCtrl.dismiss();  
}  
}

---

<div class="post-metadata">

**Author:** ![piyukore](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/piyukore/32/102073_2.png) [@piyukore](https://forum.ionicframework.com/u/piyukore)\
**Post date:** [July 7, 2016, 12:04pm UTC](https://forum.ionicframework.com/t/problem-with-loading/56830/9 "2016-07-07T12:04:23Z")

</div>

Thanks so much for your efforts @paunadeu .

Modals normally are working in my case as well … they do not work with loading component

---

<div class="post-metadata">

**Author:** ![paunadeu](https://avatars.discourse-cdn.com/v4/letter/p/9de053/32.png) [@paunadeu](https://forum.ionicframework.com/u/paunadeu)\
**Post date:** [July 7, 2016, 2:32pm UTC](https://forum.ionicframework.com/t/problem-with-loading/56830/10 "2016-07-07T14:32:54Z")

</div>

Issue opened on [https://github.com/driftyco/ionic/issues/7225](https://github.com/driftyco/ionic/issues/7225)

Same here.

---

<div class="post-metadata">

**Author:** ![nylex](https://avatars.discourse-cdn.com/v4/letter/n/7ab992/32.png) [@nylex](https://forum.ionicframework.com/u/nylex)\
**Post date:** [July 7, 2016, 3:46pm UTC](https://forum.ionicframework.com/t/problem-with-loading/56830/11 "2016-07-07T15:46:47Z")

</div>

Same problem here so i stopped using loading for now.
