Skip to content

bug: Cannot read property 'removeEventListener' of null #5989

Closed
@cperez87

Description

@cperez87

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions