0
Angular 2 ile yeni oluyorum. Bir başkasına söz verdiğimde durumum var, aşağıdaki kodla http.post ile çalışan hata mesajlarım var. Nasıl angular 2 sözü vaat ediyor
.o
burada
kullanmalıyım?export class KeyValue { constructor( private OrganizationId: string, private OrganizationFriendlyName: string) { } } export interface IComponentData { title: string; signInUrl: string; orgFriendlyName: KeyValue[]; } @Injectable() export class Api { title: string = '<Application Name>'; signInUrl: string = ''; http: Http; orgFriendlyName: KeyValue[]; postData(): Promise<KeyValue[]> { var headers = new Headers(); headers.append('Content-Type', 'application/json'); return this.http.post('url', JSON.stringify({}), { headers: headers }) .then(function(res) { .map(res => res.json()); .subscribe((res: KeyValue[]) => this.orgFriendlyName = res); }); } getComponentData(): Promise<IComponentData> { return this.postData().then(() => { return new Promise((resolve, reject) => { resolve({ title: this.title, signInUrl: this.signInUrl, orgFriendlyName: this.orgFriendlyName }); }); }); } }
POST isteğinden nasıl veri alabilirim?