Make a scope inside a function global

Im tryin to access my $rootScope.newBloodneeded but I cant access it outside the function, I tried rootscope so I can call it as global but still it gives me undefined

.controller('editbloodrequestCtrl', function($scope,Bloodrequest,$rootScope,$routeParams) {

Bloodrequest.getBloodrequest($ {
        if ( {
            $scope.newBloodneeded =;
            $rootScope.newBloodneeded = $scope.newBloodneeded;
            //gives me output when I console here
        } else {
            app.errorMsg =; // Set error message

console.log($rootScope.newBloodneeded); //gives me undefined


Source: AngularJS