本文整理匯總了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'));
}
}
示例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;
}
示例3:
['query', 'fieldClass', 'joinOp', 'matchOp'].forEach(field => {
const arr = params.getAll(field);
if (arr && arr.length) {
context[field] = arr;
}
});
示例4:
['query', 'fieldClass', 'joinOp', 'matchOp'].forEach(field => {
const arr = params.getAll(field);
if (params.has(field)) {
ts[field] = params.getAll(field);
}
});
示例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(/,/);
}
}
}