, HTTP i.e .
HTTP index.html :
<script src="node_modules/angular2/bundles/http.dev.js"></script>
HTTP_PROVIDERS .
RequestOptions, Headers etc. -, ...
import {Http, Response, RequestOptions, Headers, Request, RequestMethod} from 'angular2/http';
:
Content-Type - , username,Password, .
, . :
this.headers = new Headers();
this.headers.append("Content-Type", 'application/json');
this.headers.append("Authorization", 'confidential data or
something like that')
RequestOptions:
Bascially RequestOptions - , method (GET, POST, PUT....), url or path to json file etc, Headers body part . optipon . , RequestOptions.
this.requestoptions = new RequestOptions({
method: RequestMethod.Post,
url: "url path....",
headers: this.headers,
body: JSON.stringify(data)
});
, . , .
@Pardeep.
http://www.syntaxsuccess.com/viewarticle/angular-2.0-and-http
https://auth0.com/blog/2015/10/15/angular-2-series-part-3-using-http/
https://angular.io/docs/js/latest/api/http/Request-class.html