I have a localization component that looks like this:
(function() {
'use strict';
angular
.module('app.core')
.component('i18n', {
templateUrl: './i18n.html',
bindings: {
code: '@'
},
controller: i18n,
controllerAs: 'vm'
});
i18n.$inject = ['langStrings'];
function i18n(langStrings) {
const vm = this;
this.$onInit = () => {
vm.text = langStrings.get(vm.code);
};
}
})();
The i18n template consists of a single line:
{{vm.text}}
This works great for displaying strings, but when I want to use the string in another component or in template as a placeholder for input tag, I don't know how to apply it. So for example how would I apply the components end result for inputs placeholder in another context?
Input in some other component or template.
<input
placeholder="<i18n code='searchPlaceholder'/>"
>
I am using angularJs 1.7.2