I am writing a custom AngularJS filter to use in front-end to bold the text elements. As a generic filter, I do not want to tie it to specific elements, so document.getElementsBy is not a solution. To my understanding, i need to:
- get the input text and bold it;
- return the changed value in place and make it rendered,
The question is what possibilities do I have to get it done? I do not have an element to use element.innerHTML = content;. How can I get the element dynamically to later on apend it?
My filter:
angular.module('TestModule')
.filter('bold', ['$filter', function ($filter) {
return function (input) {
console.log(input.bold());
// code
return input.bold();
};
}]);
in html:
<div>{{ person.name|bold }}</div>
I get <b>Test1</b> in front, instead of having the bolded text. An advice in which direction should I move is appreciated.