0

i have a button which updates a counter and another button that goes to another page:

<ion-content>


<button [navPush]="aboutPage">test</button>
<p>
    {{Counter}}
</p>
<button (click)="clicking()">+</button>

<ion-content>

and the code behind:

import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';
import { AboutPage } from '../about/about';

@Component({
  templateUrl: 'build/pages/home/home.html'
})
export class HomePage {
    public aboutPage = AboutPage;
    public Counter: number = 0;
  constructor(public navCtrl: NavController) {

  }

  clicking(){
      this.Counter++;
  }
}

1.when click the Back button from About Page(this button is there by default) the + button works behind, the Counter is increasing but the display text on the view is not updating. It is a very simple test and i don't find the issue.

  1. When click test button i have to click it twice for it to work, is this a ionic 2 issue?

Thanks, Gabi S.

Sas Gabriel
  • 1,544
  • 2
  • 20
  • 27
  • Can you post your Aboutpage? (the .ts file) – Ivar Reukers Sep 16 '16 at 08:47
  • i found the problem, it seems that my AboutPage had the selector added in the Component, i removed it and now it is working as expected, I also did some small other changes which i don't think will affect this behavior – Sas Gabriel Sep 19 '16 at 19:42
  • That was what I was about to answer hahaha, had the same problem myself, also made a stackoverflow question about it ;) – Ivar Reukers Sep 19 '16 at 19:43
  • @Ivaro18 now i am having this problem: https://plnkr.co/edit/7Q4wDtZjIS1zBDsF0etS the counter is not updating in the view :| i am going to make a question about this. – Sas Gabriel Sep 19 '16 at 20:13
  • same issue: http://stackoverflow.com/questions/39581470/ionic-2-not-updating-the-counter-property-in-html – Sas Gabriel Sep 19 '16 at 20:41

1 Answers1

0

the selector from component is not needed and breaks the app

don't use something more than you need it.

Sas Gabriel
  • 1,544
  • 2
  • 20
  • 27