How to call a function, if the width of the component's DOM element is changed? (Angular4)
问题 I have to recalculate something, if the width component's DOM element is changed. Without Angular, I solved it like this: var old_width = $("#container").width(); update(); $(window).on('resize',function() { var new_width = $("#container").width(); if(old_width != new_width) { old_width = new_width; update(); } }); I would like to solve this with Angular. Unfortunately there is no resize event for regular elements, but I would like to listen somehow for it. I could use setInterval or window