Skip to content

Instantly share code, notes, and snippets.

@refaelgold
Created June 12, 2016 06:18
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save refaelgold/50af3578850ea713304a242a7554a2a6 to your computer and use it in GitHub Desktop.
Save refaelgold/50af3578850ea713304a242a7554a2a6 to your computer and use it in GitHub Desktop.
rest api for ng2
/**
* Created by Nir Goldman on 12/06/2016.
*/
import {Injectable} from 'angular2/core';
import {Http,Headers} from 'angular2/http';
@Injectable()
export class Magento2 {
constructor(private _http: Http) {
}
getAllM2Products(){
var headers=new Headers();
headers.append('Content-Type','application/x-www-form-urlencoded');
return this._http.get('http://www.mageplayground.tk/rest/V1/categories',{
headers:headers
})
.map(res=>res.json())
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment