How do you get i18n translations into index.html file that comes with Angular CLI?

Viewed 2382

For example:

<title i18n="Title|Website Title@@websiteTitle">My super duper website</title>

This works fine in all the templates, but not the based index.html file.

1 Answers

The index.html is just a static file, not related to any component, so you cant bind properties.

Have a look in to https://angular.io/api/platform-browser/Title

Since an Angular application can't be bootstrapped on the entire HTML document ( tag) it is not possible to bind to the text property of the HTMLTitleElement elements (representing the tag). Instead, this service can be used to set and get the current title value.

UPDATE: https://angular.io/guide/set-document-title

Related