diff --git a/docs/en/UI/Angular/Title-Strategy-Service.md b/docs/en/UI/Angular/Title-Strategy-Service.md index 4e7e98b234..5266bfd0a3 100644 --- a/docs/en/UI/Angular/Title-Strategy-Service.md +++ b/docs/en/UI/Angular/Title-Strategy-Service.md @@ -4,7 +4,7 @@ This strategy is based on the title property. Provide a title property when setting a new route. -**Example:** +**Example** ```ts { @@ -14,8 +14,6 @@ This strategy is based on the title property. Provide a title property when sett }, ``` -**`Note:`** - - It is better to use localized text in the title property. It will be translated by **LocalizationService**. - The **`title`** property is already set in **ABP internal packages**. diff --git a/npm/ng-packs/packages/core/src/lib/core.module.ts b/npm/ng-packs/packages/core/src/lib/core.module.ts index eb475074ce..b77849d44c 100644 --- a/npm/ng-packs/packages/core/src/lib/core.module.ts +++ b/npm/ng-packs/packages/core/src/lib/core.module.ts @@ -24,7 +24,7 @@ import { ToInjectorPipe } from './pipes/to-injector.pipe'; import { CookieLanguageProvider } from './providers/cookie-language.provider'; import { LocaleProvider } from './providers/locale.provider'; import { LocalizationService } from './services/localization.service'; -import { OTHERS_GROUP } from './tokens'; +import { DISABLE_PROJECT_NAME, OTHERS_GROUP } from './tokens'; import { localizationContributor, LOCALIZATIONS } from './tokens/localization.token'; import { CORE_OPTIONS, coreOptionsFactory } from './tokens/options.token'; import { TENANT_KEY } from './tokens/tenant-key.token'; @@ -40,12 +40,11 @@ import { DefaultQueueManager } from './utils/queue'; import { IncludeLocalizationResourcesProvider } from './providers/include-localization-resources.provider'; import { SORT_COMPARE_FUNC, compareFuncFactory } from './tokens/compare-func.token'; import { AuthErrorFilterService } from './abstracts'; -import { DYNAMIC_LAYOUTS_TOKEN } from "./tokens/dynamic-layout.token"; -import { DEFAULT_DYNAMIC_LAYOUTS } from "./constants"; +import { DYNAMIC_LAYOUTS_TOKEN } from './tokens/dynamic-layout.token'; +import { DEFAULT_DYNAMIC_LAYOUTS } from './constants'; import { AbpTitleStrategy } from './services/title-strategy.service'; import { LocalStorageListenerService } from './services/local-storage-listener.service'; - const standaloneDirectives = [ AutofocusDirective, InputEventDebounceDirective, @@ -201,12 +200,16 @@ export class CoreModule { IncludeLocalizationResourcesProvider, { provide: DYNAMIC_LAYOUTS_TOKEN, - useValue: options.dynamicLayouts || DEFAULT_DYNAMIC_LAYOUTS + useValue: options.dynamicLayouts || DEFAULT_DYNAMIC_LAYOUTS, }, { provide: TitleStrategy, - useExisting: AbpTitleStrategy - } + useExisting: AbpTitleStrategy, + }, + { + provide: DISABLE_PROJECT_NAME, + useValue: options.disableProjectNameInTitle || false, + }, ], }; } diff --git a/npm/ng-packs/packages/core/src/lib/models/common.ts b/npm/ng-packs/packages/core/src/lib/models/common.ts index 714f2422c2..704fde958a 100644 --- a/npm/ng-packs/packages/core/src/lib/models/common.ts +++ b/npm/ng-packs/packages/core/src/lib/models/common.ts @@ -15,6 +15,7 @@ export namespace ABP { localizations?: Localization[]; othersGroup?: string; dynamicLayouts?: Map; + disableProjectNameInTitle?: boolean; } export interface Child { diff --git a/npm/ng-packs/packages/core/src/lib/services/title-strategy.service.ts b/npm/ng-packs/packages/core/src/lib/services/title-strategy.service.ts index b250009124..2b00338ab6 100644 --- a/npm/ng-packs/packages/core/src/lib/services/title-strategy.service.ts +++ b/npm/ng-packs/packages/core/src/lib/services/title-strategy.service.ts @@ -11,7 +11,7 @@ import { DISABLE_PROJECT_NAME } from '../tokens'; export class AbpTitleStrategy extends TitleStrategy { protected readonly title = inject(Title); protected readonly localizationService = inject(LocalizationService); - protected readonly disableProjectName = inject(DISABLE_PROJECT_NAME, { optional: true }) || false; + protected readonly disableProjectName = inject(DISABLE_PROJECT_NAME, { optional: true }); protected routerState: RouterStateSnapshot; langugageChange = toSignal(this.localizationService.languageChange$); @@ -26,7 +26,6 @@ export class AbpTitleStrategy extends TitleStrategy { } override updateTitle(routerState: RouterStateSnapshot) { - // routerState assignment is necessary for the language change this.routerState = routerState; const title = this.buildTitle(routerState);