@ViewChild(Content) - content is undefined and I can't scroll to bottom



I’ve just detected that sometimes when I add rows to my list and try to scroll to bottom using:

//@ViewChild(Content) content: Content;

my content var is undefined sometimes, so I can’t scroll down.

Any help, please?

Thank you.


@Corin I don’t know when you are calling the content method in your code, but did you put that call inside ngOnInit, ngOnChanges or something like that? Maybe the view was not initiated yet. Try to use only after the view was loaded (after ngAfterViewInit was called).


Thank you for your help Lucas, but no I am calling it just when I enter some message in my chat. :S

Maybe I need to give enough time to the list grow?


@Corin Content should be defined. Are you using @ViewChild(Content) in the same component that has the ion-content tag in the html template? (that is, it’s not a super-component nor a sub-component)


Yes, in the same component and the problem is android only. :frowning: