AngularJS safe $rootScope.$apply