Tabs scope no update


#1

Tabs scope no update

I make a query to a remote server in service, the data controller assigned to the scope but not reflected in html .

###Controller
`

          .controller('TabCtrl', function($scope, $state,$timeout,notifications) {

            $scope.doRefresh = function() {

              $timeout( function() {
               
                notifications.count().then(function(response) {

                    $scope.data = {
                      badgeCountNew: response.news,
                      badgeCountMessage: response.messages,
                      badgeCountEvent: response.events
                    };

                });

              }, 2000);

            };

            $scope.checkTab = function(place){
              $scope.doRefresh();
              $state.go("tab."+place);
            }

          })

`

###Service
`

  .service('notifications', function($http) {

    var user = JSON.parse(localStorage.getItem('user') || '{}');
    var app = JSON.parse(localStorage.getItem('app') || '{}');
    var idUser=user["idUsuario"];

    var notifications = {
      count: function() {

        var req = {
         method: 'POST',
         url: app["controller"]+'notifications.php',
         headers: {
           'Content-Type': ' application/json '
         },
         params: {
          user:idUser
          }
        };
        var promise = $http(req).then(function (response) {
          return response.data;
        });
        return promise;
      }
    };
    return notifications;
  })

`