本文整理汇总了TypeScript中@angular/router.ParamMap类的典型用法代码示例。如果您正苦于以下问题:TypeScript ParamMap类的具体用法?TypeScript ParamMap怎么用?TypeScript ParamMap使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ParamMap类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1:
( paramMap: ParamMap ) : void => {
this.filterText = ( paramMap.get( "filterText" ) || "" );
this.filterType = ( paramMap.get( "filterType" ) || "active" );
this.applyFilterToList();
}
示例2:
this.route.paramMap.subscribe((params: ParamMap) => {
this.recordTab = params.get('tab');
this.recordId = +params.get('id');
this.searchContext = this.staffCat.searchContext;
if (!this.recordTab) {
this.recordTab = this.defaultTab || 'catalog';
}
this.loadRecord();
});
示例3:
( paramMap: ParamMap ) : void => {
console.warn( "Param-map value:", paramMap.get( "id" ) );
if ( paramMap.get( "id" ) === "3" ) {
console.warn( "Navigating back to root." );
this.router.navigate( [ "/" ] );
}
}
示例4: setTimeout
( params: ParamMap ) : void => {
console.log( "Parent ID changed:", params.get( "id" ) );
this.id = params.get( "id" );
// Simulate loading the data from some external service.
this.isLoading = true;
this.timer = this.timer = setTimeout(
() : void => {
this.isLoading = false;
},
1000
);
}
示例5: switchMap
switchMap((params: ParamMap) => {
const gamenr = params.get('gamenr')
this.logger.debug(`extracted ${gamenr}`)
if(gamenr){
return this.betterdb.getGameWithBetsForUsers(parseInt(gamenr))
} else {
//TODO: maybe redirect
return EMPTY
}
}))
示例6: incrementHitCount
route.paramMap.subscribe(async (params: ParamMap) => {
// short param is definitely defined because we can only here from the
// route with short defined
const short = params.get('short') as string;
const snapshot =
(await db.collection('links').doc<Link>(short).ref.get());
const dest = snapshot.data() as Link | undefined;
if (dest !== undefined) {
const incrementHitCount =
fns.httpsCallable<string, void>('callableIncrementHitCount');
incrementHitCount(short);
window.location.replace(dest.content);
} else {
window.location.replace(environment.baseUrl);
}
});
示例7: 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'));
}
}
示例8:
( paramMap: ParamMap ) : void => {
this.projectType = ( paramMap.get( "projectType" ) || null );
// When switching the project type, we need to reset the options.
this.selectedOption = "";
this.options = [];
switch ( this.projectType ) {
case "board":
this.options = [ "Masonry", "Meticulous", "Grid" ];
break;
case "prototype":
this.options = [ "Desktop (Web)", "iPad", "Android Tablet", "iPhone", "Android Phone", "Apple Watch", "Android Watch" ];
break;
}
}
示例9:
CATALOG_CCVM_FILTERS.forEach(code => {
const ccvmVal = params.get(code);
if (ccvmVal) {
ts.ccvmFilters[code] = ccvmVal.split(/,/);
} else {
ts.ccvmFilters[code] = [''];
}
});
示例10:
CATALOG_CCVM_FILTERS.forEach(code => {
const val = params.get(code);
if (val) {
context.ccvmFilters[code] = val.split(/,/);
} else {
context.ccvmFilters[code] = [''];
}
});