• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript http.URLSearchParams类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中@angular/http.URLSearchParams的典型用法代码示例。如果您正苦于以下问题:TypeScript URLSearchParams类的具体用法?TypeScript URLSearchParams怎么用?TypeScript URLSearchParams使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了URLSearchParams类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: Headers

import { Injectable } from '@angular/core';
import { Http, Headers, RequestOptions, Response, URLSearchParams } from '@angular/http';
import { Observable } from 'rxjs/Observable';
import 'rxjs/add/observable/throw';

const baseUrl = 'https://api.mlab.com/api/1/databases/reits/collections';
const apiKey = 'EhpBOdclXrepXAuPKpXeijpuT19p2peh';

const headers = new Headers({ 'Content-Type': 'application/json' });
const params = new URLSearchParams();

params.set('apiKey', apiKey);

const options = new RequestOptions({
  headers: headers,
  search: params
});

const jsonResponse = ((response: Response) => response.json());
const jsonError = (error: Response) => {
  const json = error.json();
  json['status'] = error.status;
  return Observable.throw(json);
};

@Injectable()
export class ApiService {

  constructor(private http: Http) {}

  get(url: string): Observable<Response> {
开发者ID:CrisLi,项目名称:reits-console,代码行数:31,代码来源:api.service.ts


示例2: outlier

  outlier(configuration, inputs, cube) {
    const that = this;
    const body = new URLSearchParams();

    if (configuration.name === 'LOF_AGGREGATE') {
      body.set('BABBAGE_AGGREGATE_URI', inputs['BABBAGE_AGGREGATE_URI']);
    } else {
      body.set('BABBAGE_FACT_URI', inputs['BABBAGE_FACT_URI']);
    }


    return that.http.get(configuration.endpoint.toString(), {search: body}).map(res => {
      return res.json();
    }).mergeMap(resp => {


      const headersAdditional = new Headers;
      headersAdditional.append('Cache-control', 'no-cache');
      headersAdditional.append('Cache-control', 'no-store');
      headersAdditional.append('Expires', '0');
      headersAdditional.append('Pragma', 'no-cache');

      return this.http.get(environment.DAMUrl + '/results/' + resp.jobid, {'headers': headersAdditional})
        .map(res => {
          const response = res.json();

          if (!response.hasOwnProperty('result')) {
            throw new Error('ex');

          }
          if (configuration.name === 'LOF_FACTS' || configuration.name === 'LOF_AGGREGATE') {
            const values: any = response.result.result;
            return {values: values};

          } else {
            const values: any = response.result;
            const new_values = [];
            const mappings = {};

            Object.keys(values[0]).forEach(function (key) {
              mappings[key] = key;
              cube.model.dimensions.forEach(function (dimension) {
                dimension.significants.forEach(function (attribute) {
                  if (key === (dimension.ref + '_' + attribute.shortRef).toLowerCase()) {
                    mappings[key] = attribute.ref;
                  }
                });
              });
              cube.model.measures.forEach(function (measure) {
                if (key === (measure.ref).toLowerCase()) {
                  mappings[key] = 'Target';
                }
              })
            });
            values.forEach(function (value) {
              const new_value = {};
              Object.keys(value).forEach(function (key) {
                new_value[mappings[key]] = value[key];
              });
              new_values.push(new_value);
            });


            return {values: new_values};

          }


        }).retryWhen(function (attempts) {
          return Observable.range(1, environment.DAMretries).zip(attempts, function (i) {
            return i;
          }).flatMap(function (i) {
            console.log('delay retry by ' + i + ' second(s)');
            if (i === environment.DAMretries) {
              return Observable.throw(new JobTimeoutException);
            }
            return Observable.timer(i * environment.DAMpollingInitialStep);
          });
        });
    });


  }
开发者ID:okgreece,项目名称:indigo,代码行数:83,代码来源:analysis.ts


示例3: timeseries

  timeseries(configuration, inputs) {
    const that = this;
    const body = new URLSearchParams('', new PureURIEncoder());
    body.set('amount', '\'' + inputs['amount'] + '\'');
    body.set('time', '\'' + inputs['time'] + '\'');
    body.set('prediction_steps', inputs['prediction_steps']);
    body.set('json_data', '\'' + (inputs['json_data']) + '\'');

    return that.http.post(configuration.endpoint.toString(), body).map(res => {
      const response = res.json();


      const forecasts = response['forecasts'];
      const values: any = [];
      for (let i = 0; i < forecasts.data_year.length; i++) {
        values.push({
          year: parseInt(forecasts.data_year[i], 10),
          amount: parseFloat(forecasts.data[i])
        });
      }
      for (let i = 0; i < forecasts.predict_time.length; i++) {
        const val: any = {
          year: parseInt(forecasts.predict_time[i], 10),
          amount: parseFloat(forecasts.predict_values[i])

        };


        if (!isNaN(forecasts.up80[i])) {
          val.up80 = parseFloat(forecasts.up80[i]);
        }
        if (!isNaN(forecasts.up95[i])) {
          val.up95 = parseFloat(forecasts.up95[i]);
        }
        if (!isNaN(forecasts.low80[i])) {
          val.low80 = parseFloat(forecasts.low80[i]);
        }
        if (!isNaN(forecasts.low95[i])) {
          val.low95 = parseFloat(forecasts.low95[i]);
        }

        values.push(val);
      }
      const acfRegular = response['acf.param']['acf.parameters'];
      const acfValues = [];

      for (let i = 0; i < acfRegular['acf.lag'].length; i++) {
        acfValues.push({
          lag: parseFloat(acfRegular['acf.lag'][i]),
          correlation: parseFloat(acfRegular['acf'][i])
        });
      }

      const pacfRegular = response['acf.param']['pacf.parameters'];
      const pacfValues = [];

      for (let i = 0; i < pacfRegular['pacf.lag'].length; i++) {
        pacfValues.push({
          lag: parseFloat(pacfRegular['pacf.lag'][i]),
          correlation: parseFloat(pacfRegular['pacf'][i])
        });
      }


      const acfResiduals = response['acf.param']['acf.residuals.parameters'];
      const acfResValues = [];

      for (let i = 0; i < acfResiduals['acf.residuals.lag'].length; i++) {
        acfResValues.push({
          lag: parseFloat(acfResiduals['acf.residuals.lag'][i]),
          correlation: parseFloat(acfResiduals['acf.residuals'][i])
        });
      }

      const pacfResiduals = response['acf.param']['pacf.residuals.parameters'];
      const pacfResValues = [];

      for (let i = 0; i < pacfResiduals['pacf.residuals.lag'].length; i++) {
        pacfResValues.push({
          lag: parseFloat(pacfResiduals['pacf.residuals.lag'][i]),
          correlation: parseFloat(pacfResiduals['pacf.residuals'][i])
        });
      }


      const stl_plot = response.decomposition['stl.plot'];
      const trends: any = [];
      for (let i = 0; i < stl_plot.time.length; i++) {
        const val: any = {
          year: parseInt(stl_plot.time[i], 10),
          amount: parseFloat(stl_plot.trend[i])
        };
        if (stl_plot['conf.interval.low']) {
          if (!isNaN(stl_plot['conf.interval.low'][i])) {
            val.low80 = parseFloat(stl_plot['conf.interval.low'][i]);
          }
        }
        if (stl_plot['conf.interval.up']) {
          if (!isNaN(stl_plot['conf.interval.up'][i])) {
            val.up80 = parseFloat(stl_plot['conf.interval.up'][i]);
//.........这里部分代码省略.........
开发者ID:okgreece,项目名称:indigo,代码行数:101,代码来源:analysis.ts


示例4: getParams

 protected getParams():URLSearchParams{
     let params = new URLSearchParams();
     this._select && params.set("$select", this._select);
     this._expand && params.set("$expand", this._expand);
     return params;
 }
开发者ID:dmurawsky,项目名称:ionic2-odata,代码行数:6,代码来源:operation.ts


示例5: getPerson

	getPerson(nhsNumber : string) : Observable<UIPatient> {
		var params = new URLSearchParams();
		params.append('nhsNumber', nhsNumber);

		return this.httpGet('api/recordViewer/getPerson', {search: params});
	}
开发者ID:endeavourhealth,项目名称:DataChecker,代码行数:6,代码来源:recordViewer.service.ts


示例6: getServiceName

	getServiceName(uuid : string) : Observable<string> {
		let params = new URLSearchParams();
		params.set('serviceId', uuid);
		return this.httpGet('api/recordViewer/getServiceName', {search: params});
	}
开发者ID:endeavourhealth,项目名称:DataChecker,代码行数:5,代码来源:countReport.service.ts


示例7: params

    public params(object: Object) : URLSearchParams {
        let params: URLSearchParams = null;

        if (object) {
            let paramsLength = 0;
            params = new URLSearchParams();

            for (var key in object) {
                if (!object.hasOwnProperty(key)) {
                    continue;
                }

                var obj = object[key];

                if (obj === undefined || obj === null) {
                    continue;
                }


                if (key === 'ordenamiento' && typeof obj === "object") {

                    let fields = "";
                    let firstField = true;
                    for (var subKey in obj) {

                        if (!obj.hasOwnProperty(subKey)) {
                            continue;
                        }

                        let value = obj[subKey];

                        if (value === undefined) {
                            continue;
                        }

                        let prefix = firstField ? "" : ",";

                        let order = ""; //asc
                        if (obj[subKey] === false) {
                            order = "-"; //desc
                        }

                        fields += `${prefix}${order}${subKey}`;
                        firstField = false;
                    }

                    if (fields.length > 0) {
                        params.append(key, fields);
                    }
                    

                } else {
                    params.append(key, obj);
                }
                paramsLength++;
            }

            if (!paramsLength) {
                params = null;
            }
        }

        return params;
    }
开发者ID:umggt,项目名称:bodegas,代码行数:64,代码来源:http.servicio.ts


示例8: getProcesses

 getProcesses(sort: string): Observable<any> {
     let params: URLSearchParams = new URLSearchParams();
     params.set('sort', sort);
     return this.getData('/system/os/processes', params);
 }
开发者ID:michaeldesigaud,项目名称:vm-dashboard,代码行数:5,代码来源:http.service.ts


示例9: getActiveTournaments

 public getActiveTournaments(): Observable<Tournament[]> {
     let params = new URLSearchParams();
     params.set('state', 'active');
     return this.getTournaments(params);
 }
开发者ID:feibeck,项目名称:fussi,代码行数:5,代码来源:tournament.service.ts


示例10:

 Object.keys(params || {}).forEach(key => { searchParams.append(key, params[key]) })
开发者ID:iDevJS,项目名称:idevjs-angular-client,代码行数:1,代码来源:api.ts



注:本文中的@angular/http.URLSearchParams类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript http.XHRBackend类代码示例发布时间:2022-05-28
下一篇:
TypeScript http.ResponseOptions类代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap