Empty Scope when rotating the device ionic

i’m working on a mobile app using ionic, and i need to handle the view when the device is rotated , so i used this code to detect the screen with and update the view :

$scope.calculateDimensions = function(gesture) {
  $scope.dev_width = $window.innerWidth;
  $scope.dev_height = $window.innerHeight;
  $scope.devider = parseInt($scope.dev_width / 150);
}

angular.element($window).bind('resize', function(){
  $scope.$apply(function() {
    $scope.calculateDimensions();
    console.log(JSON.stringify($scope.data));
    load_data($scope.data);
  })       
});

first time m’y $scope.data contain à json array but when i rotât thé device m’y $scope.data show me an empty array [].

thanks