There the npm module ng2-metadata [ https://www.npmjs.com/package/ng2-metadata]
it will serve the needs.
Sample code.
export const routes = [
{
path: 'home',
component: HomeComponent,
data: {
metadata: {
title: 'Sweet home',
description: 'Home, home sweet home... and what?'
}
}
},
{
path: 'duck',
component: DuckComponent,
data: {
metadata: {
title: 'Rubber duckie',
description: 'Have you seen my rubber duckie?'
}
}
},
{
path: 'toothpaste',
component: ToothpasteComponent,
data: {
metadata: {
title: 'Toothpaste',
override: true, // prevents appending/prepending the application name to the title attribute
description: 'Eating toothpaste is considered to be too healthy!'
}
}
}
...
];
app.module.ts
imports: [
...
RouterModule.forRoot(routes),
MetadataModule.forRoot()
],
.
constructor(private metadataService: MetadataService) { }