Hi,
I have one problem after upgrade from beta.11 to RC.0/RC.1 (I don’t know which RC break this for me.)
I can implement content.scrollToTop() when user Click on app Title.
This is me implementation:
HTML:
<ion-title (click)="scrollToTop()">{{ title | translate }}</ion-title>
TS:
import { ViewChild } from '@angular/core';
import { Content } from 'ionic-angular';
export class ActivityList extends AbstractComponent {
@ViewChild(Content) content: Content;
....
scrollToTop() {
console.log(this.content); <---- undefined !
this.content.scrollToTop();
}
}
But mi content is undefined, and I don’t know why.
Is this a bug?
Thanks.
Anyone with this problem?
Siltor
3
Hi, did you try adding #content
on your ion-title ?
That’s how I do it in my app and it’s working fine.
yes I try this, and it’s not work for me.
Siltor
5
Hum, thats kinda weird, I tried this on my project and it works fine:
<ion-title #content class="ion-title-align" (click)="test()">Title</ion-title>
And in my class
import { Component, ViewChild } from "@angular/core";
import { Content } from 'ionic-angular';
@Component({
templateUrl: "testt.html",
})
export class TestClass{
@ViewChild(Content) content: Content;
public test() {
console.log(this.content);
}
}
@tomco3131 I think you should have an ion-content
tag in your html template so that @ViewChild
could see it, but I see only an ion-title
.