ng-sm / title

Angular - page title module based on ngx-translate
2 stars 1 forks source link
angular angular-title angular-translate angular9 i18n ngsm ngx-translate page-title title

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