Ionic – Snippets trash bin

Table of Contents

TRASH BIN

				
					  localgetJson() {
    const baseUrl = 'https://semi-quantitative.com/wobi/json_test/server.php';
    const headers = {};
    let requestUrl = `${baseUrl}`;
    console.log(requestUrl);
    this.http.get(requestUrl, { headers: headers, responseType: 'json' }).subscribe(data => {
      console.log(data);
      this.user = data;
    }
    );
  }
				
			
				
					  getjson() {
    const headers = {
      "Access-Control-Allow-Origin":"https://semi-quantitative.com/wobi/json_test/server.php",
      "origin":"http://localhost:8100/home"
  }

    let requestUrl = `${this.baseUrl}`;
    return this.http.get(requestUrl, { headers: headers }).toPromise();
  }
  
 
  
  getjson2() {
    let requestUrl = `${this.baseUrl}`;
    return this.http.get(requestUrl).toPromise();
  }
  
  
  
    postjson2() {
    const headers = { 'content-type': 'application/json' }
    const body = this.jsonpostdata;
    this.http.post(this.baseUrl, body, { 'headers': headers }).subscribe(
      (response) => console.log(response),
      (error) => console.log(error)
    );
  }
  
  
  
    postjson2() {
    var parameter = { title: 'Angular POST Request Example' };
    const headers = { 'content-type': 'application/json' };
    const body = this.jsonpostdata;
    this.http.post(this.baseUrl, parameter, {headers: headers} ).subscribe(data => {
      console.log(data);
    });
  }
  
  
    postjson() {
    const headers = { 'content-type': 'application/json' }
    const body = this.jsonpostdata;
    console.log(body)
    return this.http.post(this.baseUrl, body, { 'headers': headers })
  }
				
			
				
					<ion-content>
  <form>
  <ion-item>
    <ion-label position="floating">USERNAME<ion-icon name="paper-plane-outline"></ion-icon></ion-label>
    <ion-input></ion-input>
  </ion-item>
  <ion-item>
    <ion-label position="floating">PASSWORD<ion-icon name="lock-closed-outline"></ion-icon></ion-label>
    <ion-input type="PASSWORD"></ion-input>
  </ion-item>
  <ion-item>
    <ion-label>Keep me logged in</ion-label>
    <ion-checkbox (ionChange)="keepMeLoggedIn()" checked="true"></ion-checkbox>
  </ion-item>
</form>
</ion-content>



<ion-header>
  <ion-toolbar>
    <ion-title>Login</ion-title>
  </ion-toolbar>
</ion-header>

<ion-content>
  
  <ion-card>
    <ion-card-header>
      <img  alt="WobiLogo" data-src="assets/WobiLogo_Neon.png" class="lazyload" src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="><noscript><img src="assets/WobiLogo_Neon.png" alt="WobiLogo"></noscript>
      <ion-card-subtitle></ion-card-subtitle>
      <ion-card-title></ion-card-title>
    </ion-card-header>
  
    <ion-card-content>
      <form>
      <ion-item>
        <ion-input placeholder="USERNAME"></ion-input>
      </ion-item>
      <ion-item>
        <ion-input placeholder="PASSWORD" type="PASSWORD"></ion-input>
        <ion-button (click)="logMeIn()" fill="outline" slot="end">LOGIN</ion-button>
      </ion-item>
      <ion-item>
        <ion-label>Keep me logged in</ion-label>
        <ion-checkbox (ionChange)="keepMeLoggedIn()" checked="true"></ion-checkbox>
      </ion-item>
    </form>

    <ion-item>
      <ion-button (click)="exTelegram()" fill="outline" slot="end">Telegram</ion-button>
      <ion-button (click)="exPage()" fill="outline" slot="start">Google</ion-button>
    </ion-item>

    </ion-card-content>
  </ion-card>

</ion-content>