Hi Olivier Clément,

You just need it in a couple of places? I would use an callback system, 
something like this:
```javascript
angular.service('demo', [
    '',
    function () {
        var callbacks = [];
        var me = this;
        var resizeHandler = function () {
            this.size = {
                height: $win.height()
            }
            callbacks.foreach(function (cb) {
                cb(me);
            })
        }
        this.register = function (cb) {
            callbacks.push(cb);
        }
        angular.element($window).bind('resize', resizeHandler);

    }
])
```

This is obviously not production ready, but it should get you going. You 
need to add an deregister to prevent memory leaks, and for a resize event, 
I would also add debouncing. 
I would do it this way, because all resize callbacks will get called in 1 
digest loop. I think adding watches for this is indeed a bit too costly. 
The same goes for (although slightly less) using broadcast events.

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 http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to