當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript HttpClient.put方法代碼示例

本文整理匯總了TypeScript中@angular/common/http.HttpClient.put方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript HttpClient.put方法的具體用法?TypeScript HttpClient.put怎麽用?TypeScript HttpClient.put使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在@angular/common/http.HttpClient的用法示例。


在下文中一共展示了HttpClient.put方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: updateLocales

 updateLocales(map: Map<String, String>, lang) {
   let body = '{';
   if (map) {
     map.forEach((value: string, key: string) => {
       body += '"' + key + '":' + '"' + value + '",';
     });
   }
   body = body.slice(0, -1);
   body += '}';
   return this.http.put(httpApiHost + '/locales/' + lang, body, httpJsonOptions);
 }
開發者ID:informationgrid,項目名稱:ingrid-webmap-client,代碼行數:11,代碼來源:http.service.ts

示例2: getCollectionPath

 update<T extends Identifiable>(kind: ResourceType<T>, item: T): Observable<T> {
   const collectionPath = getCollectionPath(kind.typeId);
   const uri = `${API_BASE_URL}/${collectionPath}/${item.id}`;
   return this.http
     .put<T>(uri, item)
     .pipe(
       tap(entity => this.logger.log(`Updated ${kind.typeId}: ${JSON.stringify(entity)}.`)),
       retryAfter(2, 1000),
       catchError(this.handleError),
     );
 }
開發者ID:iproduct,項目名稱:course-angular,代碼行數:11,代碼來源:backend-observable.service.ts

示例3: updateVoucher

 updateVoucher(){
   var id = 1002;
   var url = "/api/vouchers/" + id;
   var vtu = { "ID": id, "Text": "Updated by Angular", "Date": "2016-04-22T16:59:32.086", "Amount": 99, "Paid": true, "Expense": false, "VATRate" : 20 };
   
   this.httpClient.put('http://localhost:5000/api/vouchers', vtu)
   .toPromise()
   .then((response)=>{
     console.log('voucher updated');
     this.result = response;})
 }
開發者ID:Equinox707,項目名稱:smartAngular2017,代碼行數:11,代碼來源:promise.component.ts

示例4: updateApi

 public updateApi(
   api: Api,
   namespace: string,
   token: string,
 ): Observable<Api> {
   const httpOptions = this.getHTTPOptions(token);
   const url = `${AppConfig.apisApiUrl}/namespaces/${namespace}/apis/${
     api.metadata.name
   }`;
   return this.http.put<Api>(url, api, httpOptions);
 }
開發者ID:marynaKhromova,項目名稱:console,代碼行數:11,代碼來源:apis.service.ts

示例5: manageUser

    /**
     * Manage an existing user or create a new one.
     *
     * @param {User} user
     * @param operation whether we're creating a new user or updating an existing one
     */
    manageUser(user: User, operation: UserOperations = UserOperations.CREATE): Observable<any> {
        let url = '/api/users';

        if (operation === UserOperations.UPDATE) {
            url += `/${user.username}`;
        }

        return this.http
            .put(url, user)
            .pipe(map(r => plainToClass(ApiResponse, r)));
    }
開發者ID:strongbox,項目名稱:strongbox-web-ui,代碼行數:17,代碼來源:user-management.service.ts

示例6: save_changes_to_comic

 save_changes_to_comic(comic: Comic, series: string, volume: string, issue_number: string): Observable<any> {
   const params = new HttpParams()
     .set('series', series)
     .set('volume', volume)
     .set('issue_number', issue_number);
   return this.http.put(`${COMIC_SERVICE_API_URL}/comics/${comic.id}`, params)
     .finally(() => {
       comic.series = series;
       comic.volume = volume;
       comic.issue_number = issue_number;
     });
 }
開發者ID:woocommerce-quiz,項目名稱:comixed,代碼行數:12,代碼來源:comic.service.ts

示例7: tap

 update<T extends Identifiable>(kind: Type<T>, item: T): Observable<T> {
   const uri = `${BASE_API_URI}${API_ENDPOINTS[kind.name]}/${item.id}`;
   return this.http
     .put<CustomResponse<T>>(uri, item)
     .pipe(
       tap(entity => this.logger.log(`Response: ${JSON.stringify(entity)}.`)),
       map(productResponse => productResponse.data),
       tap(entity => this.logger.log(`Updated: ${JSON.stringify(entity)}.`)),
       retryAfter(3, 1000),
       catchError(this.handleError),
     );
 }
開發者ID:iproduct,項目名稱:course-angular,代碼行數:12,代碼來源:backend-observable.service.ts

示例8: updateOrder

 /**
  *
  *
  * @param {any} params
  * @returns
  *
  * @memberof CheckoutService
  */
 updateOrder(params: any) {
   const url = `api/v1/checkouts/${
     this.orderNumber
     }.json?order_token=${this.getOrderToken()}`;
   return this.http
     .put<Order>(url, params)
     .pipe(
       map(order =>
         this.store.dispatch(this.actions.updateOrderSuccess(order))
       )
     );
 }
開發者ID:leninloganathan,項目名稱:angularspree,代碼行數:20,代碼來源:checkout.service.ts

示例9: changeOrderState

 /**
  *
  *
  * @returns
  *
  * @memberof CheckoutService
  */
 changeOrderState() {
   const url = `api/v1/checkouts/${
     this.orderNumber
     }/next.json?order_token=${this.getOrderToken()}`;
   return this.http
     .put<Order>(url, {})
     .pipe(
       map(order =>
         this.store.dispatch(this.actions.changeOrderStateSuccess(order))
       )
     );
 }
開發者ID:leninloganathan,項目名稱:angularspree,代碼行數:19,代碼來源:checkout.service.ts

示例10: respondToMessage

	/**
	 * Responds to a message by calling a trigger endpoint for a given workflow's execution ID.
	 * @param workflow_execution_id Execution ID of workflow to trigger
	 * @param action Action to send to trigger endpoint
	 */
	respondToMessage(workflow_execution_id: string, action: string): Promise<string[]> {
		const arg = new Argument();
		arg.name = 'action';
		arg.value = action;
		const body: object = {
			execution_ids: [workflow_execution_id],
			data_in: action,
			arguments: [arg],
		};
		return this.http.put('/api/triggers/send_data', body)
			.toPromise()
			.catch(this.utils.handleResponseError);
	}
開發者ID:iadgov,項目名稱:WALKOFF,代碼行數:18,代碼來源:messages.service.ts


注:本文中的@angular/common/http.HttpClient.put方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。