本文整理汇总了TypeScript中@angular/common/http.HttpClient.post方法的典型用法代码示例。如果您正苦于以下问题:TypeScript HttpClient.post方法的具体用法?TypeScript HttpClient.post怎么用?TypeScript HttpClient.post使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@angular/common/http.HttpClient
的用法示例。
在下文中一共展示了HttpClient.post方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: getSearchResults
getSearchResults(searchTerm) {
return this.http.post(this.apiURL + 'searchResultsPage.json', {searchTerm});
}
示例2:
public add<T>(itemName: string): Observable<T> {
const toAdd = JSON.stringify({ ItemName: itemName });
return this.http.post<T>(this.actionUrl, toAdd);
}
示例3: create
create(personId: number, command: ChargeCommand): Observable<ChargeModel> {
return this.http.post<ChargeModel>(`/api/persons/${personId}/charges`, command);
}
示例4: signup
signup(credentials: User): Observable<object> {
return this.http.post('http://localhost:8080/api/users', credentials).pipe(
mergeMap(res => this.login(credentials))
);
}
示例5: addTask
addTask(name:string,desc:string){
httpOptions.headers = httpOptions.headers.set('Authorization', window.localStorage['jwt']);
return this.http.post(url+"task",JSON.stringify({name:name,description:desc}),httpOptions);
}
示例6: addHistory
addHistory(atletaHistory: AtletaHistory) {
atletaHistory.codigo = null;
return this.http.post(`${LUF_API}/atletas/history-new`, atletaHistory);
}
示例7: create
create(personId: number, text: string): Observable<NoteModel> {
const command = { text };
return this.http.post<NoteModel>(`/api/persons/${personId}/notes`, command);
}
示例8: duplicatePlaybook
/**
* Duplicates and saves an existing playbook, it's workflows, actions, branches, etc. under a new name.
* @param playbookId ID of the playbook to duplicate
* @param newName Name of the new copy to be saved
*/
duplicatePlaybook(playbookId: string, newName: string): Promise<Playbook> {
return this.http.post(`/api/playbooks?source=${playbookId}`, { name: newName })
.toPromise()
.then((data) => plainToClass(Playbook, data))
.catch(this.utils.handleResponseError);
}
示例9: escalate
public escalate(alerts: Alert[]): Observable<Object | RestError> {
return this.http.post('/api/v1/alerts/ui/escalate', alerts).pipe(
catchError(HttpUtil.handleError));
}
示例10: save
public save(recipe: Recipe) {
if (!recipe.id) {
return this.http.post('/recipes', recipe);
}
}