Reputation: 275
I created a hook to execute a function before changing page, but I need to execute this hook only for some pages.
I've found this in the documentation :
$transitions.onBefore({ from: 'liste.**'}, function (transition) {
//code to execute when the page belongs to 'liste' route
});
But I need to specify more routes.
How could I do this ?
for exemple :
$transitions.onBefore({ from: 'liste.**', from: 'demand.**'}, function (transition) {
//code to execute when the page belongs to 'liste' route
});
That's what I tried, but I have an error so I think this is not the good way to do.
Thanks
Upvotes: 2
Views: 144
Reputation: 275
I'v found a solution by my own:
$transitions.onBefore({ from: ['liste.**','demande.**']}, function (transition) {
//code to execute when the page belongs to 'liste' route
});
Just change the 'from' to an array
Upvotes: 2