I have seperate node REST api and separate Angular 4 interface. Can I pass data from this Angular 4 to Separate REST api?

Viewed 34

I have a Separate NodeJS RESTful api and Separate angular 4 interface. Can I pass data that are submitted from the interface to RESTful api by giving path?

1 Answers

You tried call make an service like as :

import {Injectable} from '@angular/core';
import {Http, Response} from '@angular/http';
import {Observable} from 'rxjs/Rx';

@Injectable()
export class YourService {
  constructor(private http:Http) { }
  // Uses http.get() to communicate with NodeJs
  getSomeThing() {
    return this.http.get('yourAPIUrl').map((res:Response) => res.json());
  }
}
Related