title: How to fix. 'ion-toggle set on value from db'
body: <p><a href="https://i.stack.imgur.com/YwMcm.png" rel="nofollow noreferrer">enter image description here</a>Hello i want the toggle button to be set according to the value that it gets from database. I have return the object that not an issue. I just want to get it to a value. Of course the toggle could be change and send another value to db with ngModel</p>
  
  <p>I done it with disabled but thats for disabling the toggle.</p>
  
  <p>In the image you see two toggles that are off. I want the one to be on if the details.status value is 1 and not 0</p>
  
  <pre><code> &lt;ion-toggle [disabled]="!isValidStatus()" [(ngModel)]="mediaData.status"&gt;&lt;/ion-toggle&gt;
   isValidStatus()
      {
          if(this.details.status == '0')
          {
              return true;
          }
          else if(this.details.status == '1')
          {
              return false;
          }
          return false;
      }
  </code></pre>