I wanna listen and return the text of that div whenever there’s a change.
Here’s the .ts function
ngOnInit() {
var result = document.getElementById('pose-result');
console.log('test')
result.addEventListener("DOMCharacterDataModified", function (event) {
console.log('test')
}, false);
}
I’ve tried that but It’s not working, any ideas?
I know that OnInit will trigger only once but I didn’t find any solution.
Virtually every time I have typed the word “document” in an Angular app I’ve regretted it. I would suggest that a more idiomatic way to do all of this would be to use property bindings as outlined in the Tour of Heroes, chapter 3.
Well thanks for the answer but I found another solution. I changed the <div> element to <ion-input> and listened to the changes through (ionChange) event.