Commit 832fabbc authored by wudizhanche1000's avatar wudizhanche1000

AppService save

parent 623e7a48
import {Injectable} from '@angular/core';
import App from '../models/browserapp';
import {Http} from '@angular/http';
import {Http, RequestOptions, Headers} from '@angular/http';
import 'rxjs/add/operator/toPromise';
/**
* Created by weijian on 2016/12/30.
......@@ -18,4 +18,15 @@ export class AppService {
getApp(id: string): Promise<App> {
return this.http.get(`http://localhost:8000/apps/${id}`).map((response) => new App(response.json())).toPromise();
}
save(app: App): Promise<any> {
let headers = new Headers({'Content-Type': 'application/json'});
let options = new RequestOptions({headers: headers});
return this.http.post(`http://localhost:8000/apps/${app.id}`, app, options).map((response) => response.json()).toPromise();
}
update(app: App) {
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment