本文整理汇总了TypeScript中@angular/http.Http.post方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Http.post方法的具体用法?TypeScript Http.post怎么用?TypeScript Http.post使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@angular/http.Http
的用法示例。
在下文中一共展示了Http.post方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: createCategory
createCategory(category: Category) {
this.http.post(`${CATEGORY_URL}`, JSON.stringify(category), HEADER)
.map(res => res.json())
.map(payload => ({type: ADD_CATEGORY, payload}))
.subscribe(action => this.store.dispatch(action));
}
示例2: favorite
favorite(property) {
const headers = new Headers();
headers.append('Content-Type', 'application/json');
return this.http.post('/favorite', JSON.stringify({ 'property__c': property.id }), {headers: headers}).toPromise();
}
示例3: createSpace
/**
* 创建空间
*/
createSpace(param: SpaceModel): Observable<CommonResultModel> {
const options = HttpUtils.getDefaultRequestOptionsByTokenAndJSON();
return this.http.post(ApiConfig.API_SPACE_CREATE, JSON.stringify(param), options)
.map(ResultUtils.extractData);
}
示例4: addGame
addGame(gameTypeId: String, result: Number): Observable<any> {
return this.http
.post(`http://localhost:3088/api/game`, {gameTypeId: gameTypeId, result: result})
.map((response: Response) => response);
}
示例5: postScan
postScan(scan: any) : Observable<any> {
return this.http.post('/api/scans', scan)
.map(mapToJSON);
}
示例6:
create(user: User) {
return this.http.post('/api/users', user, this.jwt()).map((response: Response) => response.json());
}
示例7: save
save(keyAndPassword: any): Observable<any> {
return this.http.post('api/account/reset_password/finish', keyAndPassword);
}
示例8: save
save(ServiceProvider: ServiceProvider): Promise<ServiceProvider> {
let headers = new Headers({'Content-Type': 'application/json'});
return this.http.post(this.conf.providersURL(), JSON.stringify(ServiceProvider), {headers: headers})
.toPromise()
.then(response => response.json())
}
示例9: registerLocalUser
registerLocalUser(user: User): Observable<boolean> {
return this.http.post(this.config.links.auth.local.register, user)
.map(response => !!response);
}
示例10: insert
insert(todo: Todo): Promise<Todo> {
return this.http.post('insert', todo)
.toPromise()
.then(() => todo)
.catch(this.handleError);
}