i am in need of knowing the current screen resolution of my clients in their browsers.
i need this information in order to do calculations.
this will be my function:
scope.$watch('**??what,should,go,here??**', function() {
scope.screen = (window.innerWidth / 2) - 150;
});
as you can see i want to use a regular $watch function. my problem is that i don't know what to watch. i tried watching window.innerWidth but this doesn't worked. i supposed because this will only give a value for the first time.
i believe there is a simple solution probably.
thanks.
Bind to onresize
, e.g.
window.addEventListener("resize", function () {
// check width
});