本文整理匯總了TypeScript中@geonature_common/service/common.service.CommonService類的典型用法代碼示例。如果您正苦於以下問題:TypeScript service.CommonService類的具體用法?TypeScript service.CommonService怎麽用?TypeScript service.CommonService使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了service.CommonService類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1:
error => {
if (error.status === 403) {
this._commonService.translateToaster('error', 'NotAllowed');
} else {
this._commonService.translateToaster('error', 'ErrorMessage');
}
}
示例2:
value => {
if (value !== null && this.mapListService.colSelected.name === '') {
this._commonService.translateToaster('warning', 'MapList.NoColumnSelected');
} else {
this.mapListService.urlQuery = this.mapListService.urlQuery.delete(this.mapListService.colSelected.prop);
if (value.length > 0) {
this.mapListService.refreshData(this.apiEndPoint, 'set', [{param: this.mapListService.colSelected.prop, 'value': value}]);
} else {
this.mapListService.deleteAndRefresh(this.apiEndPoint, this.mapListService.colSelected.prop);
}
}
});
示例3: canActivate
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) {
const moduleName = route.data['module_code'];
const askedModule = this._moduleService.getModule(moduleName);
if (askedModule) {
this._globalSubService.currentModuleSubject.next(askedModule);
return true;
} else {
this._router.navigate(['/']);
this._commonService.regularToaster(
'error',
"Vous n'avez pas les droits d'accès au module " + moduleName
);
return false;
}
}