Hi Hans,
Why don't you move the entire logic into your event handler?
Something like:
app.directive('resizeWatch', function ($window) {
return function ($scope, element) {
var w = angular.element($window);
w.bind('resize', function () {
var newSize = {
width: element.innerWidth(),
height: element.innerHeight()
}
// do something
$scope.$apply();
});
}
});
Or something similar like that. I prefer to use native addEventlistener
above .bind. That's less reliant on user-land written code and accomplishes
the same feat.
Regards
Sander
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.