当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript URLSearchParams.toString方法代码示例

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


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

示例1: urlEncode

 private urlEncode(obj: any): string {
     let urlSearchParams = new ngURLSearchParams('', new TrueQueryEncoder());
     for (let key in obj) {
         urlSearchParams.append(key, obj[key]);
     }
     return urlSearchParams.toString();
 }
开发者ID:it7-solutions,项目名称:networking-public-plugin,代码行数:7,代码来源:it7-ajax.service.ts

示例2: urlEncode

 urlEncode(obj:Object):string {
   let urlSearchParams = new URLSearchParams();
   for (let key in obj) {
     urlSearchParams.append(key, obj[key]);
   }
   return urlSearchParams.toString();
 }
开发者ID:mazdik,项目名称:Angularjs_aion,代码行数:7,代码来源:request.service.ts

示例3: query

 query(base: string, options?: Object) : string {
     if (!options) return base;
     var params = new URLSearchParams();
     for (var key in options) {
         params.set(key, String(options[key]));
     }
     return base + "?" + params.toString();
 }
开发者ID:7h0ma5,项目名称:CloudShack,代码行数:8,代码来源:profile.service.ts

示例4: post

  post(username: string, password: string): Observable<UserModel> {
    const body = new URLSearchParams('', new PatchedQueryEncoder());
    body.append('username', username);
    body.append('password', password);
    const options = this.httpOptions({ 'Content-Type': 'application/x-www-form-urlencoded' });

    return this.http.post('/api/login', body.toString(), options)
      .map(res => this.setUserFromResponse(res));
  }
开发者ID:radiorabe,项目名称:raar-ui,代码行数:9,代码来源:login.service.ts

示例5: list

  public list(factoryLink: string, queryOptions: any,
              projectLink?: string): Promise<DocumentListResult> {
    let params = new URLSearchParams();
    // params.set('$limit', serviceUtils.calculateLimit().toString());
    params.set('$limit', PAGE_LIMIT);
    params.set('expand', 'true');
    params.set('documentType', 'true');
    params.set('$count', 'true');

    if (queryOptions) {
      let filter = getFilter(queryOptions);
      if(filter){
        params.set('$filter', filter);
      }
    }

    let op;
    // 2000 is th max url length. Here we don't know the hostname, so 50 chars extra
    if (params.toString().length + factoryLink.length > 1950) {
      let data = {
        uri: factoryLink + '?' + params.toString()
      };
      factoryLink = Links.LONG_URI_GET;

      op = this.post(factoryLink, data);
    } else {
      op = this.ajax.get(factoryLink, params, undefined, this.buildHeaders(projectLink));
    }

    return op.then(result => {
      let documents = result.documentLinks.map(link => {
        let document = result.documents[link];
        document.documentId = Utils.getDocumentId(link);

        return document;
      });

      return new DocumentListResult(documents, result.nextPageLink, result.totalCount);

    }).then(result => slowPromise(result));
  }
开发者ID:mdharamadas1,项目名称:admiral,代码行数:41,代码来源:document.service.ts

示例6: signIn

    // Submit signin form to backend (NOT restful service)
    signIn(signInCredential: SignInCredential): Observable<any> {
        // Build the form package
        const body = new URLSearchParams();
        body.set('principal', signInCredential.principal);
        body.set('password', signInCredential.password);

        // Trigger Http
        return this.http.post(signInUrl, body.toString(), HTTP_FORM_OPTIONS)
        .pipe(map(() => null)
        , catchError(error => observableThrowError(error)));

    }
开发者ID:reasonerjt,项目名称:harbor,代码行数:13,代码来源:sign-in.service.ts

示例7: urlEncode

    protected urlEncode(obj: Object): string {
        let urlSearchParams = new URLSearchParams();
        for (let key in obj) {
            if (!obj.hasOwnProperty(key) || obj[key] === undefined) {
                continue;
            }

            urlSearchParams.append(key, obj[key]);
        }

        return urlSearchParams.toString();
    }
开发者ID:akotsar,项目名称:buggy,代码行数:12,代码来源:base.api.service.ts

示例8: signIn

    // Submit signin form to backend (NOT restful service)
    signIn(signInCredential: SignInCredential): Promise<any> {
        // Build the form package
        const body = new URLSearchParams();
        body.set('principal', signInCredential.principal);
        body.set('password', signInCredential.password);

        // Trigger Http
        return this.http.post(signInUrl, body.toString(), HTTP_FORM_OPTIONS)
        .toPromise()
        .then(() => null)
        .catch(this.handleError);
    }
开发者ID:lengwei2018,项目名称:harbor,代码行数:13,代码来源:sign-in.service.ts

示例9: getQueryString

 getQueryString () {
   var params = new URLSearchParams('');
   if (!!this.urlParams) {
       for (var key in this.urlParams) {
           params.set(key, this.urlParams[key].id ? this.urlParams[key].id : this.urlParams[key]);
       }
   }
   params.set('username', this.username);
   params.set('api_key', this.api_key);
   params.set('format', 'json');
   return params.toString();
 }
开发者ID:pochangl,项目名称:noir_app,代码行数:12,代码来源:api.ts

示例10: resetPassword

    resetPassword(uuid: string, newPassword: string): Observable<any> {
        if (!uuid || !newPassword) {
            return observableThrowError("Invalid reset uuid or password");
        }

        let body: URLSearchParams = new URLSearchParams();
        body.set("reset_uuid", uuid);
        body.set("password", newPassword);

        return this.http.post(resetPasswordEndpoint, body.toString(), HTTP_FORM_OPTIONS)
            .pipe(map(response => response)
            , catchError(error => observableThrowError(error)));
    }
开发者ID:reasonerjt,项目名称:harbor,代码行数:13,代码来源:password-setting.service.ts


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