1
Yerelleştirme isteğinizi kullanarak yerel API Server'ımdan json verilerini almaya çalışıyorum. Her zaman bu hatayı alırım. Zaten birçok siteyi ziyaret ediyorum ama bu soruna çözüm bulamadım. Herkes neden ve nasıl düzeltebileceğini biliyor mu? daha yapılandırma bilgilerini ihtiyaç duyulan, teşekkürler401 tam kimlik doğrulaması gerekiyor
import {Injectable} from 'angular2/core';
import {Http} from "angular2/http";
import 'rxjs/add/operator/map';
import 'rxjs/Rx';
import {Headers} from "angular2/http";
import {Jsonp} from "angular2/http";
@Injectable()
export class HTTPTestService{
constructor(private _http: Http){}
getCurrentTime(){
console.log('je suis le test0');
console.log(this._http.get('http://localhost:9090/webservices/pivot/rest/v1/cube/discovery').map(res => res.json()));
console.log('je suis le test10');
return this._http.get('http://localhost:9090/webservices/pivot/rest/v1/cube/discovery')
.map(res => res.json());
}
postJSON(){
var json=JSON.stringify({var1: 'test', var2: 3});
var params = 'json=' + json;
var headers = new Headers();
headers.append('Content-Type', 'application/x-www-form-urlencoded');
return this._http.post('http://jsonplaceholder.typicode.com/posts',
params,{
headers: headers
})
.map(res => res.json());
}
}