- moved the logic to service.
- using $interval instead of setInterval