Page 1 of 1

Event when page is resized, loaded or shown

Posted: Thu Nov 03, 2016 2:22 pm
by Pasteur Miranda

Hi,

Code: Select all

Is there any way in Angular Js of listening an event when page is resized, loaded or shown?  I need to get the window(page) width and height when it's resized. 

Thank you


Event when page is resized, loaded or shown

Posted: Thu Nov 03, 2016 5:49 pm
by Serhii Kulibaba

Hello,

You can add a watcher to the $scope variable to "listen" it's changes. That function will be triggered if that variable changes


Event when page is resized, loaded or shown

Posted: Thu Nov 03, 2016 6:09 pm
by Pasteur Miranda

Hello, Sergiy, thank you for your fast return. Do you have a small sample showing how to do this?

Thank you


Event when page is resized, loaded or shown

Posted: Thu Nov 03, 2016 7:37 pm
by Serhii Kulibaba

We don't have such example, because this is default AngularJS functionality. Please look at this link how to use watchers here: https://docs.angularjs.org/api/ng/typ...