In slider directive too, there is something similar, I think a service is a good idea.