ionic-framework icon indicating copy to clipboard operation
ionic-framework copied to clipboard

bug: Cannot read property 'removeEventListener' of null

Open cperez-io opened this issue 10 years ago • 1 comments

Short description of the problem:

When I do this.viewCtrl.dismiss() on a Modal page, im getting * Cannot read property 'removeEventListener' of null*. That is, when I have an ion-infinite-scroll on the page

I have tried using this.nav.pop() and this.nav.popToRoot() and still get the same issue. The only things that has worked is removing the infinite scroll.

What behavior are you expecting?

Expecting Modal page to close without errors.

Tested with

ionic serve --lab

Sample Code

import {Page, ViewController} from 'ionic-angular';

@Page({
    template: `
    <ion-navbar>
        <ion-buttons start>
            <button (click)="closeModal()">
                Close
            </button>
        </ion-buttons>
        <ion-title>Sample</ion-title>
    </ion-navbar>

    <ion-content class="has-header">
        <ion-infinite-scroll (infinite)="loadMoreItems($event)" >
            <ion-infinite-scroll-content loadingSpinner="bubbles" loadingText="Loading items..."></ion-infinite-scroll-content>
        </ion-infinite-scroll>
    </ion-content>
    `
})
export class SamplePage {
    constructor(private viewCtrl: ViewController) {

    }

    closeModal() {
        let resultData = {a: 1, b: 2};
        this.viewCtrl.dismiss(resultData);
    }

    loadMoreItems(infiniteScroll) {
        //Some code here
    }
}

Call from a page with something like

let modal = Modal.create(SamplePage);
modal.onDismiss((data) => { 
//Do something here
});
this.nav.present(modal)

Ionic Version: 2.x

Cordova CLI: 6.1.0 (cordova-lib@undefined) Gulp version: CLI version 3.9.1 Gulp local: Local version 3.9.1 Ionic Version: 2.0.0-beta.3 Ionic CLI Version: 2.0.0-beta.23 Ionic App Lib Version: 2.0.0-beta.13 Node Version: v5.9.1

cperez-io avatar Mar 30 '16 15:03 cperez-io

#5760 Closing my post because it was already brought up in another post. Merge if needed.

cperez-io avatar Mar 30 '16 18:03 cperez-io