Skip to content
/ title Public

Angular - page title module based on ngx-translate

Notifications You must be signed in to change notification settings

ng-sm/title

Repository files navigation

Title module based on the @ngx-translate/core package.

Installation

yarn add @ngsm/title or npm i @ngsm/title --save

Requirements

Library requires @ngx-translate/core, you can use also @ngsm/i18n module.

Usage

App module:

import { I18nModule } from '@ngsm/i18n';
import { TitleModule } from '@ngsm/title';
...

@NgModule({
  imports: [
    ...
    TitleModule,
    I18nModule,
  ],
  ...
})
export class AppModule {}

Single routing:

const routes: Routes = [
  {
    path: '',
    component: MyPageComponent,
    data: {
      title: 'title.myPage',
    },
  },
];

...

Translations should be added in i18n directory in your assets (for example /src/assets/i18n/en.json):

{
  "title": {
    "myPage": "Here is my title",
    "default": "My default title",
    "suffix": "My title suffix"
  }
}

Author

Sebastian Musiał

kontakt@sebastianmusial.pl

@sebamusial