I'd like to implement a conditional .when(), like this:
.when('/abc', {
// if MyService.allow == true
template: '<myDirec></myDirec>'
// else
redirectTo: '/'
})
My /abc route shall be like "secured" by a variable hold in one of my services, in a stateful manner. So I want to set this very state somewhere else to true/false and the next time the user tries to get to /abc he will be served conditionally.
How can I achieve this? - with as few 3rd-party dependencies as possible
What I tried and read about: - Simply injecting my Service in .config, which I learnt is not possible - Read about using a provider as they can be injected. But can I use them like I use my service? - template and templateUrl accept a function, but this didn't really help me
Thanks very much in advance!