title: Access static readonly fields in Ionic
body: <p>I'm new to ionic and I don't know whether I'm doing it right. I've have two buttons UserA, UserB, both buttonsshare same function and I need to pass user-type (UserA, UserB) as parameter when user clicks on a button.</p>
  
  <p>Here's my code:</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>import {Component} from "@angular/core";
  import {IonicPage, NavController, NavParams} from "ionic-angular";
  import {BasePage} from "../base/base-page/base-page";
  import {Signup} from "../signup/signup";
  import {Fields} from "../../enums/fields/Fields";
  import {EnumOthers} from "../../enums/EnumOthers";
  
  
  @IonicPage()
  @Component({
    selector   : 'page-signup-user-type',
    templateUrl: 'signup-user-type.html',
  })
  
  
  export class SignupUserType
  {
    constructor(public navCtrl: NavController, public navParams: NavParams)
    {
    }
  
    public switchToSignup(userType: number):void
    {
      switch(userType)
      {
        case EnumOthers.USER_A:
        {
          this.navCtrl.push(PageA);
          break;
        }
  
        case EnumOthers.USER_B:
        {
          this.navCtrl.push(PageB);
          break;
        }
  
        default:
        {
          console.log("Its not working !!!");
          break;
        }
      }
    }
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;ion-header&gt;
    &lt;ion-navbar&gt;
      &lt;ion-title&gt;User Type&lt;/ion-title&gt;
    &lt;/ion-navbar&gt;
  &lt;/ion-header&gt;
  
  &lt;ion-content padding&gt;
      &lt;button ion-button color="secondary" block (click)="switchToSignup(EnumOthers.USER_A)"&gt;A User&lt;/button&gt;
      &lt;button ion-button color="secondary" block  (click)="switchToSignup(EnumOthers.USER_B)"&gt;B User&lt;/button&gt;
  &lt;/ion-content&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>I'm trying to pass those parameters as <strong>public static readonly</strong> which are not accessible in my html(Ionic). I don't want to pass hard-coded parameters.</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>export class EnumOthers
  {
    public static readonly USER_A: number = 0;
    public static readonly USER_B: number = 1;
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>Code runs successfully, but when I click the button, I get the error. <a href="https://i.stack.imgur.com/HUIbR.png" rel="nofollow noreferrer">Here's the error image</a></p>