From 41fc80adb208e8bbf0bd0a65d9c3051b78fd4501 Mon Sep 17 00:00:00 2001 From: wangtengyu <wangtengyu> Date: Fri, 09 Nov 2018 12:15:09 +0800 Subject: [PATCH] “重新提交” --- src/kl/core/services/httpclient.ts | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/src/kl/core/services/httpclient.ts b/src/kl/core/services/httpclient.ts index 8c45197..3112527 100644 --- a/src/kl/core/services/httpclient.ts +++ b/src/kl/core/services/httpclient.ts @@ -4,6 +4,8 @@ import { LoadingService } from './loading.service'; import { ApiResult } from 'kl/model'; + + @Injectable() export class HttpClient { @@ -17,6 +19,13 @@ this.getResponse(this.http.post(api, params), fun); } + getData(id: string, fun: Function) { + return this.http.get('assets/json/data.json').map((res: Response) => res.json()).subscribe(data => { + fun(data[id]); + }); + } + + xhrPost(api, data, fun) { let xhr = new XMLHttpRequest(); xhr.open('POST', api, false); -- Gitblit v1.8.0