How to use the @angular/http.URLSearchParams 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 FINRAOS / herd-ui / src / app / core / services / user.service.ts View on Github external
getCurrentUser(username?: string, password?: string): Observable {
    if (this.conf.config.useBasicAuth && username && password) {
      this.apiConf.username = username;
      this.apiConf.password = password;
    }
    // the added timestamp of the query string forces legacy browsers to not cache the http response
    // for current user.  this fixes current user differentiated tests.
    const search = new URLSearchParams(`v=${Date.now()}`.toString());
    return this.currentUserApi.currentUserGetCurrentUserWithHttpInfo({search}).map((res) => {
      this.userAuthorizations = res.json();
      this._user.next(res.json());
      this.encryptedUserIdentifier = this.encryptionService.encryptAndGet((res.json() as UserAuthorizations).userId);
      return res.json();
    });
  }
github pascalgrimaud / qualitoast / src / main / webapp / app / admin / audits / audits.service.ts View on Github external
query(req: any): Observable {
        const params: URLSearchParams = new URLSearchParams();
        params.set('fromDate', req.fromDate);
        params.set('toDate', req.toDate);
        params.set('desc', 'true');
        params.set('page', req.page);
        params.set('size', req.size);
        params.set('sort', req.sort);

        const options = {
            search: params
        };

        return this.http.get('management/audits', options);
    }
}
github Lazhari / Movies-Finder / src / app / movies.service.ts View on Github external
getMovieReviews(id: string) {
    var search = new URLSearchParams();
    search.set('api_key', this.apikey);
    return this._jsonp.get('https://api.themoviedb.org/3/movie/'+ id +'/reviews?callback=JSONP_CALLBACK', {search})
      .map(res => {
        return res.json();
      })
  }
  getMovieVideos(id: string) {
github asadsahi / AspNetCoreSpa / Client / modules / shared / services / api-gateway.service.ts View on Github external
private buildUrlSearchParams(params: any): URLSearchParams {
        let searchParams = new URLSearchParams();
        for (let key in params) {
            if (params.hasOwnProperty(key)) {
                searchParams.append(key, params[key]);
            }
        }
        return searchParams;
    }
github ag-grid / ag-grid-angular-example / docs / ng2-example / app / app.component.js View on Github external
function AppComponent() {
        this.example = 'rich-grid';
        var params = new http_1.URLSearchParams(window.location.search.replace("?", ""));
        this.example = params.get('example') ? params.get("example") : 'rich-grid';
    }
    AppComponent = __decorate([
github WeAreOpenSourceProjects / NodeAngular / libs / slides / src / services / slides.service.ts View on Github external
getSlideToSearch(textToSearch, pageIndex, pageSize): Observable {
        const params: URLSearchParams = new URLSearchParams();
        params.set('title', textToSearch.title);
        params.set('state', textToSearch.filter);
        params.set('favorite', textToSearch.favorite);
        params.set('username', this.user.username);
        params.set('pageIndex', pageIndex);
        params.set('pageSize', pageSize);
        params.set('order', textToSearch.order);
        const backendURL = `${this._baseUrl}/${environment.backend.endpoints.search}`;
        return this.http.get(backendURL, { params: params }).map((response: Response) => response.json());
    }
github Lazhari / Movies-Finder / src / app / movies.service.ts View on Github external
getMoviesByGenre(id: string) {
    var search = new URLSearchParams();
    search.set('api_key', this.apikey);
    return this._jsonp.get('https://api.themoviedb.org/3/genre/'+ id +'/movies?callback=JSONP_CALLBACK', {search})
      .map(res => {
        return res.json();
      })
  }
github bleenco / morose / src / app / services / api.service.ts View on Github external
getTeamProfile(organization: string, team: string): Observable {
    let params: URLSearchParams = new URLSearchParams();
    params.set('organization', organization);
    params.set('team', team);

    return this.get(`${this.url}/org/team/profile`, params);
  }
github jhipster / jhipster-sample-app-ng2 / src / main / webapp / app / admin / audits / audits.service.ts View on Github external
query(req: any): Observable {
        const params: URLSearchParams = new URLSearchParams();
        params.set('fromDate', req.fromDate);
        params.set('toDate', req.toDate);
        params.set('page', req.page);
        params.set('size', req.size);
        params.set('sort', req.sort);

        const options = {
            search: params
        };

        return this.http.get(SERVER_API_URL + 'management/audits', options);
    }
}
github agoncal / agoncal-application-conference / conference-angular-web-old / src / app / ms / api / DefaultApiSchedule.ts View on Github external
public allSessionsFriday(extraHttpRequestParams?: any): Observable> {
        const path = this.basePath + '/sessions/friday';

        let queryParameters = new URLSearchParams();
        let headerParams = this.defaultHeaders;
        let requestOptions: RequestOptionsArgs = {
            method: 'GET',
            headers: headerParams,
            search: queryParameters
        };

        return this.http.request(path, requestOptions)
            .map((response: Response) => {
                if (response.status === 204) {
                    return undefined;
                } else {
                    return this.getResponse(response);
                }
            });
    }