title: Updating tab badge dynamically on Ionic 2
body: <p>I wish to update dynamically a badge value, when I click on a button.</p>
  
  <p><strong>tabs.html</strong></p>
  
  <pre><code>...
          &lt;ion-tab [root]="tab1Root" tabTitle="Product" tabIcon="search"&gt;&lt;/ion-tab&gt;
          &lt;ion-tab [root]="tab2Root" tabTitle="Cart" tabIcon="cart" tabBadge="{{cartCount}}" tabBadgeStyle="danger"&gt;&lt;/ion-tab&gt;
  ...
  </code></pre>
  
  <p><strong>tabs.ts</strong></p>
  
  <pre><code>export class TabsPage {
  ...
      cartCount = 0;
  
      tab1Root = ProductPage;
      tab2Root = CartPage;
  ...
  }
  </code></pre>
  
  <p><strong>product.html</strong></p>
  
  <pre><code>&lt;button ion-button full (click)="updateCart('add', p.id)"&gt;Buy Now&lt;/button&gt;
  </code></pre>
  
  <p><strong>product.ts</strong></p>
  
  <pre><code>export class ProductPage {
  ...
      updateCart(action, id) {
          let cartCount = 1;
  
          let alert = this.alertCtrl.create({
              title: 'Success!',
              subTitle: 'You have added 1 product to the cart.',
              buttons: ['OK']
          });
  
          alert.present();
      }
  ...
  }
  </code></pre>
  
  <p>As I tought, <code>let cartCount = 1;</code> does nothing. I've searched for a solution, but most of them are for Ionic 1 or AngularJS, which didn't helped me at all.</p>