Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

219
Visualizações
How to make a FORM PUT request through rxjs ajax?

Jquery request objects have a property by the name 'data' which is used to set form data and make a form request with the right headers.

I wanted to achieve the same in rxjs ajax but could not find a way. The only exhaustive list of request configuration properties I could find was this https://github.com/Reactive-Extensions/RxJS-DOM/blob/master/doc/operators/ajax.md

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

The documentation for RxJS5 is not complete yet on that part, but you can use it as follows:

 import {Observable} from "rxjs/Observable";
 import "rxjs/add/observable/dom/ajax";

 const url = "http://my-site.org/some/endpoint";
 const request$ = Observable.ajax.put(url, {a: "test"});
 request$.subscribe(x => console.log(x));

And of course all other REST-methods are available

  Observable.ajax(urlOrRequest: string | AjaxRequest): Observable<AjaxResponse>;
  Observable.ajax.get(url: string, headers?: Object): Observable<AjaxResponse>;
  Observable.ajax.post(url: string, body?: any, headers?: Object): Observable<AjaxResponse>;
  Observable.ajax.put(url: string, body?: any, headers?: Object): Observable<AjaxResponse>;
  Observable.ajax.patch(url: string, body?: any, headers?: Object): Observable<AjaxResponse>;
  Observable.ajax.delete(url: string, headers?: Object): Observable<AjaxResponse>;
  Observable.ajax.getJSON<T>(url: string, headers?: Object): Observable<T>;

If you want to send a fully custom ajax-request, you can use the following interface:

interface AjaxRequest {
  url?: string;
  body?: any;
  user?: string;
  async?: boolean;
  method?: string;
  headers?: Object;
  timeout?: number;
  password?: string;
  hasContent?: boolean;
  crossDomain?: boolean;
  withCredentials?: boolean;
  createXHR?: () => XMLHttpRequest;
  progressSubscriber?: Subscriber<any>;
  responseType?: string;
}

All take from here: https://github.com/ReactiveX/rxjs/blob/0ab1d3b4d1178a1d31c49c737832cde767da3fb1/src/observable/dom/AjaxObservable.ts

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda