title: SyntaxError: Unexpected token < in JSON at position 1 ionic
body: <p>How can I solve this problem? Could you please help me. Thank you.
  I ran into a similar error which turned out to be a typo in the HTML within the render function, but that doesn't seem to be the case here.</p>
  
  <p>More confusingly, I rolled the code back to an earlier, known-working version and I'm still getting the error.</p>
  
  <p>error message;</p>
  
  <pre><code>SyntaxError: Unexpected token &lt; in JSON at position 1
          at JSON.parse (&lt;anonymous&gt;)
          at Response.Body.json (http://localhost:8100/build/vendor.js:67304:25)
          at SafeSubscriber._next (http://localhost:8100/build/main.js:358:29)
          at SafeSubscriber.__tryOrUnsub (http://localhost:8100/build/vendor.js:32821:16)
          at SafeSubscriber.next (http://localhost:8100/build/vendor.js:32768:22)
          at Subscriber._next (http://localhost:8100/build/vendor.js:32708:26)
          at Subscriber.next (http://localhost:8100/build/vendor.js:32672:18)
          at XMLHttpRequest.onLoad (http://localhost:8100/build/vendor.js:67797:38)
          at t.invokeTask (http://localhost:8100/build/polyfills.js:3:15660)
          at Object.onInvokeTask (http://localhost:8100/build/vendor.js:4973:33)
  </code></pre>
  
  <p>providers/auth-service.ts</p>
  
  <pre><code>import { Injectable } from '@angular/core';
  import { Http, Headers } from '@angular/http';
  import 'rxjs/add/operator/map';
  
  let apiUrl = "http://localhost/PHP-Slim-Restful/api/";
  
  
  @Injectable()
  export class AuthServiceProvider {
  
    constructor(public http: Http) {
      console.log('Hello AuthService Provider');
    }
  
    postData(credentials, type){
  
      return new Promise((resolve, reject) =&gt;{
        let headers = new Headers();
        this.http.post(apiUrl+type, JSON.stringify(credentials), {headers: headers}).
        subscribe(res =&gt;{
          resolve(res.json());
        }, (err) =&gt;{
          reject(err);
        });
  
      });
  
    }
  
  }
  </code></pre>
  
  <p>signup.ts</p>
  
  <pre><code>import { Component } from '@angular/core';
      import { IonicPage, NavController, NavParams } from 'ionic-angular';
      import { TabsPage } from '../tabs/tabs';
      import { LoginPage } from '../login/login';
      import { AuthServiceProvider } from '../../providers/auth-service/auth-service';
      import 'rxjs/add/operator/map';
  
  @IonicPage()
  @Component({
    selector: 'page-signup',
    templateUrl: 'signup.html',
  })
  export class SignupPage {
    responseData: any;
    userData = { "username": "", "password": "", "email": "", "name": "" };
    constructor(
      public navCtrl: NavController,
      public navParams: NavParams,
      public authService: AuthServiceProvider) {
    }
  
    ionViewDidLoad() {
  
    }
    signup() {
      //api connections
  
      this.authService.postData(this.userData, "signup")
        .then((result) =&gt; {
          this.responseData = result;
          console.log(this.responseData);
          localStorage.setItem('userData', JSON.stringify(this.responseData))
          this.navCtrl.push(TabsPage);
        }, (err) =&gt; {
  
          //connection failed message
        });
    }
    login() {
      this.navCtrl.push(LoginPage);
    }
  }
  </code></pre>
  
  <p>signup html</p>
  
  <pre><code>&lt;!--
    Generated template for the SignupPage page.
  
    See http://ionicframework.com/docs/components/#navigation for more info on
    Ionic pages and navigation.
  --&gt;
  &lt;ion-header&gt;
  
    &lt;ion-navbar&gt;
      &lt;ion-title&gt;Kayıt OL&lt;/ion-title&gt;
    &lt;/ion-navbar&gt;
  
  &lt;/ion-header&gt;
  
  
  &lt;ion-content padding&gt;
    &lt;ion-list&gt;
      &lt;ion-item&gt;
        &lt;ion-label floating&gt;Adınız&lt;/ion-label&gt;
        &lt;ion-input type="text" [(ngModel)]="userData.name"&gt;&lt;/ion-input&gt;
      &lt;/ion-item&gt;
      &lt;ion-item&gt;
        &lt;ion-label floating&gt;Mail Adresiniz&lt;/ion-label&gt;
        &lt;ion-input type="text" [(ngModel)]="userData.email"&gt;&lt;/ion-input&gt;
      &lt;/ion-item&gt;
      &lt;ion-item&gt;
        &lt;ion-label floating&gt;Kullanıcı Adı&lt;/ion-label&gt;
        &lt;ion-input type="text" [(ngModel)]="userData.username"&gt;&lt;/ion-input&gt;
      &lt;/ion-item&gt;
  
      &lt;ion-item&gt;
        &lt;ion-label floating&gt;Şifre&lt;/ion-label&gt;
        &lt;ion-input type="password" [(ngModel)]="userData.password"&gt;&lt;/ion-input&gt;
      &lt;/ion-item&gt;
  
    &lt;/ion-list&gt;
  
    &lt;div padding&gt;
      &lt;button ion-button block (click)="signup()"&gt;Üye Ol&lt;/button&gt;
    &lt;a href="#" (click)="login()"&gt;Login Page&lt;/a&gt;
    &lt;/div&gt;
  &lt;/ion-content&gt;
  </code></pre>