本文整理匯總了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);
}