title: Chart issue when using it inside a segment on Ionic2 project
body: <p>I'm trying to use a chart (imported from Chart.js) controlled by a segment at Ionic2, but when I put the chart inside the segment condition, the following error occurs:</p>
  
  <blockquote>
    <p>Runtime Error
    <em>this.barCanvas is undefined</em></p>
  </blockquote>
  
  <p>Outside the segment control, the chart works well.</p>
  
  <p>This is my home.ts and home.html file:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>//home.ts file
  import {
    Component,
    ViewChild
  } from '@angular/core';
  import {
    NavController,
    Platform
  } from 'ionic-angular';
  import {
    Chart
  } from 'chart.js';
  
  
  @Component({
    selector: 'page-home',
    templateUrl: 'home.html'
  })
  export class HomePage {
  
    @ViewChild('public barCanvas') public barCanvas;
  
    public barChart: any;
  
    tipoGrafico: string = "geral";
    isAndroid: boolean = false;
  
    constructor(platform: Platform) {
      this.isAndroid = platform.is('android');
    }
  
  
  
  
    ionViewDidLoad() {
  
      this.barChart = new Chart(this.barCanvas.nativeElement, {
  
        //parameters of my graphic...
  
      });
  
    }
  
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>    &lt;!-- home.html file --&gt;
      &lt;ion-header&gt;
        &lt;ion-navbar no-border-bottom&gt;
          &lt;ion-title&gt;
            Segments
          &lt;/ion-title&gt;
        &lt;/ion-navbar&gt;
  
        &lt;ion-toolbar no-border-top&gt;
          &lt;ion-segment [(ngModel)]="tipoGrafico"&gt;
            &lt;ion-segment-button value="geral"&gt;
              Geral
            &lt;/ion-segment-button&gt;
            &lt;ion-segment-button value="dipositivo"&gt;
              Dispositivo
            &lt;/ion-segment-button&gt;
          &lt;/ion-segment&gt;
        &lt;/ion-toolbar&gt;
      &lt;/ion-header&gt;
  
      &lt;ion-content&gt;
        &lt;div [ngSwitch]="tipoGrafico"&gt;
          &lt;div *ngSwitchCase="'dispositivo'"&gt;
            --&gt;
            &lt;ion-card&gt;
              Grafico semana --&gt;
              &lt;ion-card-content&gt;
                &lt;canvas #barCanvas&gt;&lt;/canvas&gt;
              &lt;/ion-card-content&gt;
            &lt;/ion-card&gt;
          &lt;/div&gt;
        &lt;/div&gt;
  
      &lt;/ion-content&gt;
  
      &lt;ion-content&gt;
        &lt;div [ngSwitch]="tipoGrafico"&gt;
          &lt;ion-list *ngSwitchCase="'geral'"&gt;
            &lt;ion-item&gt;
              &lt;ion-thumbnail item-start&gt;
                &lt;img src="assets/img/teste.jpg"&gt;
              &lt;/ion-thumbnail&gt;
              &lt;h2&gt;Geral&lt;/h2&gt;
            &lt;/ion-item&gt;
          &lt;/ion-list&gt;
        &lt;/div&gt;
      &lt;/ion-content&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>I don't have much ability with these languages so any help will be welcome!</p>