title: AngularJs+TypeScript: How to implement if else condition in Angular Controller
body: <p>I am trying to implement a if else condition in angular controller.I have taken a dropdown and on its index change i am binding my another drop down.I have tried ng-if too but it will hide the whole dropdown where i want the dropdown visible .Here is my html code:-</p>
  
  <pre><code>&lt;div data-ng-app="CustomerNew" data-ng-controller="CreateCustomerCtrl as custom" ng-init="getFormData();"&gt;
  &lt;table style="width: 144% ! important;" class="TableStyle1" id="Table1" cellspacing="0" cellpadding="2" border="0"&gt;
      &lt;tr&gt;
          &lt;td&gt;Billing Type:&lt;/td&gt;
          &lt;td&gt;
              &lt;select id="listBillingType" ng-change="listBillingTypeselectedindexchange(custom.listBillingType)" data-ng-options="blngtype as blngtypee for (blngtype,blngtypee) in listBillingType" data-ng-model="custom.listBillingType" style="width: 182px !important; height: 34px;"&gt;
                  &lt;option value=""&gt;Choose an option {{optional ? '(optional)' : ''}}&lt;/option&gt;
              &lt;/select&gt;
          &lt;/td&gt;
      &lt;/tr&gt;
  </code></pre>
  
  <p>Another Dropdown which i am trying to populate on the basis of above dropdown index.</p>
  
  <pre><code>&lt;tr&gt;
      &lt;td nowrap style="height: 26px"&gt;Parent Account:&lt;/td&gt;
      &lt;td style="height: 26px"&gt;
          &lt;select id="listParentAccount" data-ng-options="prntact as prntact.AccountNumber +' - '+ prntact.FullName for prntact in listParentAccount" ng-model="custom.listParentAccount" style="width: 182px !important; height: 34px;"&gt;
              &lt;option value=""&gt;Choose an option {{optional ? '(optional)' : ''}}&lt;/option&gt;
          &lt;/select&gt;
      &lt;/td&gt;
  &lt;/tr&gt;
  </code></pre>
  
  <p>Here is my Controller</p>
  
  <pre><code>module CustomerNew.controllers {
      export class CreateCustomerCtrl {
          static $inject = ['$scope', '$http', '$templateCache'];
          debugger;
          constructor(protected $scope: ICustomerScope,
          protected $http: ng.IHttpService,
          protected $templateCache: ng.ITemplateCacheService) {
              $scope.listBillingTypeselectedindexchange = this.listBillingTypeselectedindexchange;
          }
          public listBillingTypeselectedindexchange = (index) = &gt; {
              debugger;
              var indexvalue = {
                  BillingTypesindex: index
              }
              if (index === "3" || index === "4" || index === "5") this.$http.put(dolistsalesindex, indexvalue).
              success((data, status, headers, config) = &gt; {
                  debugger;
                  this.$scope.listParentAccount = data["listParentAccount"];
              }).
              error((data, status) = &gt; {
                  debugger;
                  console.log("In Error:-in index");
                  alert(data);
              });
          }
      }
  </code></pre>
  
  <p><strong>Here i want if selected index value is 3,4,5 than only it will go to my api else will return blank.</strong> </p>