Skip to content

Commit

Permalink
update ABP.Root interface and core module providers
Browse files Browse the repository at this point in the history
  • Loading branch information
Sinan997 committed May 16, 2024
1 parent ce58640 commit 71d4349
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
4 changes: 1 addition & 3 deletions docs/en/UI/Angular/Title-Strategy-Service.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

This strategy is based on the title property. Provide a title property when setting a new route.

**Example:**
**Example**

```ts
{
Expand All @@ -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**.

Expand Down
17 changes: 10 additions & 7 deletions npm/ng-packs/packages/core/src/lib/core.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -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,
Expand Down Expand Up @@ -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,
},
],
};
}
Expand Down
1 change: 1 addition & 0 deletions npm/ng-packs/packages/core/src/lib/models/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export namespace ABP {
localizations?: Localization[];
othersGroup?: string;
dynamicLayouts?: Map<string, string>;
disableProjectNameInTitle?: boolean;
}

export interface Child {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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$);
Expand All @@ -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);

Expand Down

0 comments on commit 71d4349

Please sign in to comment.