Refactored the JS Object to be an Angular service

I refactored your JavaScript object to be an Angular service to be injected into your Directive.