當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript ParamMap.getAll方法代碼示例

本文整理匯總了TypeScript中@angular/router.ParamMap.getAll方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript ParamMap.getAll方法的具體用法?TypeScript ParamMap.getAll怎麽用?TypeScript ParamMap.getAll使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在@angular/router.ParamMap的用法示例。


在下文中一共展示了ParamMap.getAll方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: applyUrlParams

    applyUrlParams(context: CatalogSearchContext, params: ParamMap): void {

        // Reset query/filter args.  The will be reconstructed below.
        context.reset();

        // These fields can be copied directly into place
        ['format', 'sort', 'available', 'global', 'identQuery', 'identQueryType']
        .forEach(field => {
            const val = params.get(field);
            if (val !== null) {
                context[field] = val;
            }
        });

        if (params.get('limit')) {
            context.pager.limit = +params.get('limit');
        }

        if (params.get('offset')) {
            context.pager.offset = +params.get('offset');
        }

        ['query', 'fieldClass', 'joinOp', 'matchOp'].forEach(field => {
            const arr = params.getAll(field);
            if (arr && arr.length) {
                context[field] = arr;
            }
        });

        CATALOG_CCVM_FILTERS.forEach(code => {
            const val = params.get(code);
            if (val) {
                context.ccvmFilters[code] = val.split(/,/);
            } else {
                context.ccvmFilters[code] = [''];
            }
        });

        params.getAll('facets').forEach(blob => {
            const facet = JSON.parse(blob);
            context.addFacet(new FacetFilter(facet.c, facet.n, facet.v));
        });

        if (params.get('org')) {
            context.searchOrg = this.org.get(+params.get('org'));
        }
    }
開發者ID:jamesrf,項目名稱:Evergreen,代碼行數:47,代碼來源:catalog-url.service.ts

示例2: transform

  /**
   * Returns the leaflet map bounds
   *
   * @param params
   *     query string parameters
   *
   * @return {any}
   *     leaflet map bounds
   */
  transform(params: ParamMap): any {
    if (!params) {
      return null;
    }

    const parsed = [];
    const bounds = params.getAll('bounds');
    bounds.forEach(b => {
      if (!b) {
        return;
      }
      parsed.push(b.split(',').map(n => +n));
    });

    if (parsed.length === 0) {
      return null;
    }
    return parsed;
  }
開發者ID:ehunter-usgs,項目名稱:earthquake-eventpages,代碼行數:28,代碼來源:interactive-map-bounds.pipe.ts

示例3:

 ['query', 'fieldClass', 'joinOp', 'matchOp'].forEach(field => {
     const arr = params.getAll(field);
     if (arr && arr.length) {
         context[field] = arr;
     }
 });
開發者ID:jamesrf,項目名稱:Evergreen,代碼行數:6,代碼來源:catalog-url.service.ts

示例4:

 ['query', 'fieldClass', 'joinOp', 'matchOp'].forEach(field => {
     const arr = params.getAll(field);
     if (params.has(field)) {
         ts[field] = params.getAll(field);
     }
 });
開發者ID:StephenGWills,項目名稱:Evergreen,代碼行數:6,代碼來源:catalog-url.service.ts

示例5: applyUrlParams

    applyUrlParams(context: CatalogSearchContext, params: ParamMap): void {

        // Reset query/filter args.  The will be reconstructed below.
        context.reset();
        let val;

        if (params.get('org')) {
            context.searchOrg = this.org.get(+params.get('org'));
        }

        if (val = params.get('limit')) {
            context.pager.limit = +val;
        }

        if (val = params.get('offset')) {
            context.pager.offset = +val;
        }

        if (val = params.get('sort')) {
            context.sort = val;
        }

        if (val = params.get('global')) {
            context.global = val;
        }

        if (val = params.get('showBasket')) {
            context.showBasket = val;
        }

        if (params.get('marcValue')) {
            context.marcSearch.tags = params.getAll('marcTag');
            context.marcSearch.subfields = params.getAll('marcSubfield');
            context.marcSearch.values = params.getAll('marcValue');
        }

        if (params.get('identQuery')) {
            context.identSearch.value = params.get('identQuery');
            context.identSearch.queryType = params.get('identQueryType');
        }

        if (params.get('browseTerm')) {
            context.browseSearch.value = params.get('browseTerm');
            context.browseSearch.fieldClass = params.get('browseClass');
            if (params.has('browsePivot')) {
                context.browseSearch.pivot = +params.get('browsePivot');
            }
        }

        const ts = context.termSearch;

        // browseEntry and query searches may be facet-limited
        params.getAll('facets').forEach(blob => {
            const facet = JSON.parse(blob);
            ts.addFacet(new FacetFilter(facet.c, facet.n, facet.v));
        });

        if (params.has('hasBrowseEntry')) {

            ts.hasBrowseEntry = params.get('hasBrowseEntry');

        } else if (params.has('query')) {

            // Scalars
            ['format', 'available', 'date1', 'date2',
                'dateOp', 'groupByMetarecord', 'fromMetarecord']
            .forEach(field => {
                if (params.has(field)) {
                    ts[field] = params.get(field);
                }
            });

            // Arrays
            ['query', 'fieldClass', 'joinOp', 'matchOp'].forEach(field => {
                const arr = params.getAll(field);
                if (params.has(field)) {
                    ts[field] = params.getAll(field);
                }
            });

            CATALOG_CCVM_FILTERS.forEach(code => {
                const ccvmVal = params.get(code);
                if (ccvmVal) {
                    ts.ccvmFilters[code] = ccvmVal.split(/,/);
                } else {
                    ts.ccvmFilters[code] = [''];
                }
            });

            if (params.get('copyLocations')) {
                ts.copyLocations = params.get('copyLocations').split(/,/);
            }
        }
    }
開發者ID:StephenGWills,項目名稱:Evergreen,代碼行數:94,代碼來源:catalog-url.service.ts


注:本文中的@angular/router.ParamMap.getAll方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。