From 6f73091539a6e2e2aab08ca708abaa99884c6efb Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Thu, 17 Sep 2020 12:16:01 -0400 Subject: [PATCH] make npm run export-strings happier MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The UrlMatcher function used by the provider interface needs to spelled slighly differently to avoid the AOT compiler used by "npm run export-strings" from failing with the following error: ERROR in Error during template compile of 'AcqProviderRoutingModule' Function expressions are not supported in decorators in 'ɵ0' 'ɵ0' contains the error at app/staff/acq/provider/routing.module.ts(7,14) Consider changing the function expression into an exported function Signed-off-by: Galen Charlton --- .../app/staff/acq/provider/routing.module.ts | 60 ++++++++++--------- 1 file changed, 31 insertions(+), 29 deletions(-) diff --git a/Open-ILS/src/eg2/src/app/staff/acq/provider/routing.module.ts b/Open-ILS/src/eg2/src/app/staff/acq/provider/routing.module.ts index 32f678580d..3344d33337 100644 --- a/Open-ILS/src/eg2/src/app/staff/acq/provider/routing.module.ts +++ b/Open-ILS/src/eg2/src/app/staff/acq/provider/routing.module.ts @@ -1,37 +1,39 @@ import {NgModule} from '@angular/core'; -import {RouterModule, Routes, UrlMatchResult} from '@angular/router'; +import {RouterModule, Routes, UrlSegment, UrlMatchResult} from '@angular/router'; import {AcqProviderComponent} from './acq-provider.component'; import {ProviderResolver, CanLeaveAcqProviderGuard} from './resolver.service'; +export function providerRouteMatcher(segments: UrlSegment[]) { + // using a custom matcher so that we + // don't force a component re-initialization + // when navigating from the search form to a + // provider record + if (segments.length === 0) { + return { + consumed: segments, + posParams: {} + }; + } else if (segments.length === 1) { + return { + consumed: segments, + posParams: { + id: segments[0], + } + }; + } else if (segments.length > 1) { + return { + consumed: segments, + posParams: { + id: segments[0], + tab: segments[1], + } + }; + } + return (null as any); +} + const routes: Routes = [ - { matcher: (segments) => { - // using a custom matcher so that we - // don't force a component re-initialization - // when navigating from the search form to a - // provider record - if (segments.length === 0) { - return { - consumed: segments, - posParams: {} - }; - } else if (segments.length === 1) { - return { - consumed: segments, - posParams: { - id: segments[0], - } - }; - } else if (segments.length > 1) { - return { - consumed: segments, - posParams: { - id: segments[0], - tab: segments[1], - } - }; - } - return (null as any); - }, + { matcher: providerRouteMatcher, component: AcqProviderComponent, resolve: { providerResolver : ProviderResolver }, canDeactivate: [CanLeaveAcqProviderGuard], -- 2.43.2