本文整理汇总了TypeScript中@angular/router.ParamMap.has方法的典型用法代码示例。如果您正苦于以下问题:TypeScript ParamMap.has方法的具体用法?TypeScript ParamMap.has怎么用?TypeScript ParamMap.has使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@angular/router.ParamMap
的用法示例。
在下文中一共展示了ParamMap.has方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1:
['query', 'fieldClass', 'joinOp', 'matchOp'].forEach(field => {
const arr = params.getAll(field);
if (params.has(field)) {
ts[field] = params.getAll(field);
}
});
示例2: 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(/,/);
}
}
}
示例3: addQueryParam
private addQueryParam(name: string, map: ParamMap): string {
return map.has(name) ? name + "=" + map.get(name) + "&" : "";
}