currently i`m trying to find out how to handle window:onresize event in angular2. i have embedded it in a components template like this:
<div class="signaturepadContainer" (window:resize)="onResize($event)">
and handle the event in ts-file like
onResize(event: any){ ...dosomethingterrible... }
in my 'event'-parameter i have in 'curenTarge', 'source' and 'target' reference to 'window', but not to my div.
Where am i wrong ?
By adding
window:you make it a global event handler. Even though you added it to a div, it's not related to this div at all. It would behave the same no matter where you add it.You can also use
to have less confusing code.