In .html
file I have:
<div id="container">
</div>
I want to add a button
inside it, with some text which should be translated.
I can do It like this:
var container = document.getElementById('container');
var button = document.createElement('button');
button.innerText = this.translate.instant('SOME_TEXT');
container.appendChild(button);
Problem here is that this SOME_TEXT
will be translated only one time. If language will change while this button is displayed - text won't change.
I would like to make something like:
button.innerHTML = `{{'DONE' | translate}}`;
, where translate
is translate: TranslateService,
in constructor
, and I do import { TranslateService } from '@ngx-translate/core';
Is it possible?