Display Data from database after connecting with AuthService


#1

Hello i have connected my app with a PHP restful API (auth service)

import { Injectable } from '@angular/core';
import { Http, Headers } from '@angular/http';
import 'rxjs/add/operator/map';

let apiUrl = "http://localhost**/PHP-Slim-Restful1/api/**";

@Injectable()
export class AuthService {

  constructor(public http: Http) {
    console.log('Hello AuthService Provider');
  }

  postData(credentials, type){

    return new Promise((resolve, reject) =>{
      let headers = new Headers();
      this.http.post(apiUrl+type, JSON.stringify(credentials), {headers: headers}).
      subscribe(res =>{
        resolve(res.json());
      }, (err) =>{
        reject(err);
      });

    });

  }

}

Can you post a script to call a PHP function from /PHP-Slim-Restful1/api/ on home.ts and display data on home.html? Or a example or link? Thanks