ionViewLoaded() not firing


#1

I tried using the ionViewLoaded function to set a class on page load but it’s not firing. So I tried just logging a message. It still doesn’t work. What am I doing wrong?

import {IONIC_DIRECTIVES, NavController, ViewController} from 'ionic-angular';
@Component({
    selector: 'my-component',
    directives: [IONIC_DIRECTIVES],
    template: '<button class="{{dynamic-class}}">Hello</button>'
})

export class myComponentClass {

public constructor() {}

    ionViewLoaded() {
        console.log("who lives in a pineapple?");    
    }
}

#2

This is only available in the latest nightly release, so you probably do not have access to this ATM.


#3

Tried in beta.9, ionViewLoaded still not firing.


#4

Same ^ … i have the global ionic up to date and the most recent version of the conference app and still no dice.


#5

Please provide solution for this.


#6

Can’t you use ionViewDidEnter?


#7

Nope its working.

stephan kristyn


#8

For anybody new coming to this, ionViewLoaded() is no longer a valid lifecycle event.

See https://ionicframework.com/docs/v2/api/navigation/NavController/#lifecycle-events for a full list of events. It seems that what was ionViewLoaded is now ionViewDidLoad.


A White Screen Result When Integerting Google Map javascript sdk