Hi Shishir,
so the reason why the dimensions are not correct is because when your callback gets called the repeater contents has not be set yet (the ng:bind has not run) So the numbers you are getting are for an empty repeater, hence the discrepancy.
What, you want to do is to get the numbers after the page is computed.
If this is a one time deal, then you can simply defer it thought window.setTimeout(workFn, 0); method. This well run your code after the eval is done and things have the right dimensions. This is a second time I ran into this problem, so maybe we will have a better way to do it in angular.
If you want to call a callback after every eval, but it should be last callback, you can do scope.$postEval(workFn); to register a function to run at the end of the eval cycle.
What is it that you are trying to achieve with this? If you want to have a generic center method you could do something like this.
angular.directive('ng:center', function(){
return function(element) {
function center(){
element.left($(window).width()/2);
}
$(window).size(center);
setTimeout(center, 0);
};