Injection should be done in $get for providers. Also, small fix to keep jshint from complaining.

Move the injection of $q and $rootScope to the $get method since this is a provider. Defined handleResultWitPromise as "functino handleResultWithPromise" so hoisting will handle resolving the function call in vfRemote.send().