How to use the @angular/http.RequestMethod.Put function in @angular/http

To help you get started, we’ve selected a few @angular/http examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ova2 / angular-development-with-primeng / chapter9 / crud-datatable / src / app / backend / fake-backend.ts View on Github external
let newEmployee = Object.assign(receivedEmployee, {id: uuid.generate()});
                data[data.length] = newEmployee;

                localStorage.setItem('employees', JSON.stringify(data));

                connection.mockRespond(new Response(new ResponseOptions({
                    status: 200,
                    body: newEmployee
                })));

                return;
            }

            // update employee
            if (connection.request.url.endsWith('/fake-backend/employees') &&
                connection.request.method === RequestMethod.Put) {
                let receivedEmployee = JSON.parse(connection.request.getBody());
                let clonedEmployee = Object.assign({}, receivedEmployee);
                let employeeWasFound = false;
                data.some((element: Employee, index: number) => {
                    if (element.id === clonedEmployee.id) {
                        data[index] = clonedEmployee;
                        employeeWasFound = true;
                        return true;
                    }
                });
                
                if (!employeeWasFound) {
                    connection.mockRespond(new Response(new ResponseOptions({
                        status: 400,
                        body: 'Employee could not be updated because was not found'
                    })));
github outcobra / outstanding-cobra / frontend / src / app / core / http / http-interceptor.ts View on Github external
public put(url: string, data: any, apiName?: string, params?: any): Observable {
        return this.request({
            method: RequestMethod.Put,
            url: url,
            data: data,
            params: params,
            apiName: apiName
        });
    }
github Azure / BatchExplorer / app / services / arm-http.service.ts View on Github external
public put(uri: string, options?: RequestOptionsArgs) {
        return this.request(uri, mergeOptions(options, RequestMethod.Put));
    }
github dotCMS / core-web / src / app / portlets / shared / dot-content-types-edit / components / fields / service / field.service.ts View on Github external
saveFields(contentTypeId: string, fields: DotCMSContentTypeLayoutRow[]): Observable {

        return this.coreWebService
            .requestView({
                body: {
                    layout: fields
                },
                method: RequestMethod.Put,
                url: `v3/contenttype/${contentTypeId}/fields/move`
            })
            .pipe(pluck('entity'));
    }
github dotCMS / core-web / src / app / api / services / dot-contentlet-locker / dot-contentlet-locker.service.ts View on Github external
lock(inode: string): Observable {
        return this.coreWebService
            .requestView({
                method: RequestMethod.Put,
                url: `content/lock/inode/${inode}`
            })
            .pipe(pluck('bodyJsonObject'));
    }
github dotCMS / core-web / src / app / api / services / crud / crud.service.ts View on Github external
public putData(baseUrl: string, data: any): Observable {
        return this.coreWebService.requestView({
            body: data,
            method: RequestMethod.Put,
            url: `${baseUrl}`
        }).pluck('entity');
    }
github paulhobbel / angular2-auth / src / auth.http.ts View on Github external
public put(url: string, body: any, options?: RequestOptionsArgs): Observable {
        return this.requestHelper({ body: body, method: RequestMethod.Put, url: url }, options);
    }
github myopenresources / cc / src / app / shared / http / http.service.ts View on Github external
public put(url: string, body: any = null, success: Function=function(successful, data, res){}, error: Function=function(successful, msg, err){}): any {
        return this.request(url, new RequestOptions({
            method: RequestMethod.Put,
            body: body
        }), success, error);
    }
github box / samples / box-auth0-angular2-skeleton-app-sample / src / app / services / box / box-client.service.ts View on Github external
public put(url: string, body: any, options?: RequestOptionsArgs): Observable {
        return this.requestHelper({ body: body, method: RequestMethod.Put, url: this.constructUrl(url) }, options);
    }