Replaced $scope by $rootScope