1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

Capacitor/Ionic: not live updating a binding's value

Discussão em 'Angular' iniciado por Wouter Vandenputte, Julho 16, 2025.

  1. This is like the most basic functionality ever in an Angular project but somehow it won't work on Ionic when running neither for iOS nor on Web.

    This is a pages' template

    <ion-header [translucent]="true">
    <ion-toolbar>
    <ion-buttons slot="start">
    <ion-back-button></ion-back-button>
    </ion-buttons>
    <ion-title> My title </ion-title>
    </ion-toolbar>
    </ion-header>
    <ion-content>
    test: {{somevalue}}
    </ion-content>


    and this is the component

    @Component({
    selector: 'app-some-page',
    templateUrl: './some.page.html',
    imports: [IonTitle, IonContent, IonBackButton, IonButtons, IonToolbar, IonHeader],
    })
    export class SomePage
    {
    public get somevalue(): number
    {
    return new Date().getTime();
    }
    }


    My somevalue just simply remains the same in the view. I get a number when I go on the page and it won't change. Shouldn't angular binding update this view constantly every change detection cycle? I know for 100% sure that the time is changing. Putting a breakpoint in the code also shows it is called in the beginning but not anymore after rendering.

    I created this project using no weird exotic configuration, just default Ionic CLI.

    Continue reading...

Compartilhe esta Página