本文整理汇总了TypeScript中@angular/common/http.HttpClient.patch方法的典型用法代码示例。如果您正苦于以下问题:TypeScript HttpClient.patch方法的具体用法?TypeScript HttpClient.patch怎么用?TypeScript HttpClient.patch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@angular/common/http.HttpClient
的用法示例。
在下文中一共展示了HttpClient.patch方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: modifyContactTag
modifyContactTag(contactId: number, params): Observable<any> {
const url = `${Constants.apiContacts}/${contactId}`;
return this.http
.patch(url, params)
.pipe(catchError(this.handleError('modifyContactTag', null)));
}
示例2: updateNote
public updateNote(note: Note): Observable<Note> {
const updateNoteUrl = `https://whiteraven.azurewebsites.net/api/notes/${note.id}`;
return this.http.patch<Response<Note>>(updateNoteUrl, { title: note.title, content: note.content })
.pipe(
tap(r => {
const indexInAll = this.dataStore.allNotes.findIndex(x => x.id === r.data.id);
this.dataStore.allNotes[indexInAll] = r.data;
this._allNotes.next([...this.dataStore.allNotes]);
const indexInMy = this.dataStore.myNotes.findIndex(x => x.id === r.data.id);
if (indexInMy >= 0) {
this.dataStore.myNotes[indexInMy] = r.data;
this._myNotes.next([...this.dataStore.myNotes]);
return;
}
const indexInEditable = this.dataStore.editableNotes.findIndex(x => x.id === r.data.id);
if (indexInEditable >= 0) {
this.dataStore.editableNotes[indexInEditable] = r.data;
this._editableNotes.next([...this.dataStore.editableNotes]);
return;
}
throw new Error('Note was not found in the editable collections');
}),
map(r => r.data));
}
示例3: updateAclString
updateAclString(rootDn:string, aclStrVal:string){
let headers = this.authService.getAuthHeader();
let body = this.constructSDJsonBody(aclStrVal);
let url = 'https://' + this.domain + ':' + this.configService.API_PORT + '/v1/vmdir/ldap';
url += '?dn=' + encodeURIComponent(rootDn);
console.log(url);
return this.httpClient.patch(url, body, {headers})
.share()
.map((res: Response) => res)
.catch(this.handleError)
}
示例4: updateAttributes
updateAttributes(rootDn:string, originalValMap:Map<string,any>, attribsArr:string[], modifiedAttributesMap:Map<string,any>, schemaMap:Map<string,any>): Observable<string[]> {
let headers = this.authService.getAuthHeader();
let body = this.constructJsonBody(originalValMap, attribsArr, modifiedAttributesMap, schemaMap);
this.getUrl = 'https://' + this.domain + ':' + this.configService.API_PORT + '/v1/vmdir/ldap';
let updateUrl = this.getUrl + '?dn='+rootDn;
console.log(updateUrl);
return this.httpClient.patch(updateUrl, body, {headers})
.share()
.map((res: Response) => res)
.catch(this.handleError)
}
示例5: switchMap
switchMap(user => {
return this.http.patch('/_api/v1/user/changepassword', {
old_password: oldPassword,
new_password: newPassword,
retype_password: newPassword,
},
{
headers: { 'X-Authorization': 'Bearer ' + user.token }
}
);
})
示例6:
patch<T>(url: string, body: string): Observable<T> {
return this.http.patch<T>(url, body);
}
开发者ID:FabianGosebrink,项目名称:ASPNET-Foodchooser-Cross-Platform-Angular2,代码行数:3,代码来源:httpWrapper.service.ts
示例7:
patch<TResponseBody>(url: string, data?: any): Observable<HttpResponse<TResponseBody>> {
return this.httpClient.patch<TResponseBody>(url, JSON.stringify(data), { observe: 'response' });
}
示例8: updateUser
updateUser(id: any, user: any) {
return this.http.patch(`${environment.url}/users/${id}`, user);
}
示例9: changeScheduledTaskStatus
changeScheduledTaskStatus(scheduledTaskId: number, actionName: string): Promise<void> {
return this.http.patch('/api/scheduledtasks', { id: scheduledTaskId, action: actionName })
.toPromise()
.then(() => null)
.catch(this.utils.handleResponseError);
}
示例10: renamePlaybook
/**
* Renames an existing playbook.
* @param playbookId Current playbook ID to change
* @param newName New name for the updated playbook
*/
renamePlaybook(playbookId: string, newName: string): Promise<Playbook> {
return this.http.patch('/api/playbooks', { id: playbookId, name: newName })
.toPromise()
.then((data: object) => plainToClass(Playbook, data))
.catch(this.utils.handleResponseError);
}