Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
import { Component, OnInit } from '@angular/core';
import { MyService } from '/myService.service';
selector: 'app-MyComponent-interface',
templateUrl: './MyComponent.component.html',
styleUrls: ['./MyComponent.component.css']
export class MyComponent implements OnInit {
constructor(private myService:MyService) { }
ngOnInit() {
//use response
let headers = new Headers({ 'Content-Type': 'application/json'});
let options = new RequestOptions({ headers: headers });
return this.http.get( '/recentData', options).map(res=>res.json()); //No Base URL required
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment