Title module based on the @ngx-translate/core package.
yarn add @ngsm/title
or npm i @ngsm/title --save
Library requires @ngx-translate/core
, you can use also @ngsm/i18n
module.
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"
}
}
Sebastian Musiał |