Should I use create a service of type "Provider" only to verify if the user is logged in?

0

I have an application that makes use of the ngRoute module.

When the url of a restricted page is accessed, I check if the user is logged in and then allow access. But I was replicating this routine in various parts of my code. So I thought, I'm going to encapsulate this into a service. But for my unhappiness services of type factory and service are not accessible in block config of my module. So I thought I'd use provider .

But there it is. Is this the only way to separate my check routine or is there some way that is more trivial?

    
asked by anonymous 10.08.2016 / 21:26

0 answers