I think thats about right. However this would be checked on each new URL
correct? For this project, some pages would be accessible without being
logged in and others would need Auth. I'm assuming I'd need to do
something from within UI-Router as well in order to get it working and only
make this call based on the route its going to.
P.S. Side note, but thanks so much for the response. Within so many other
groups it seems almost impossible to get beginner level help on things but
AngularJS has been amazing!
On Thursday, March 27, 2014 12:20:19 AM UTC-7, Sander Elias wrote:
>
> Hi John,
>
> you mean you want to do something like this?
>
> app.run([
> '$location', '$rootScope',
> function ($location, $rootScope) {
> $rootScope.on('$routeChangeStart', function () {
> if (checkForLogin()) {
> $location.path('/gotoLogin');
> }
> });
> }
> ]);
>
> It work as follows, if a new route is being called, the route Provider
> will send out the event. This code intercepts this event, checks if it
> needs a login (you have to provide this code) and redirects when needed.
> I typed this up in the browser, so there might be some syntax issues with
> it, but it should get you started.
>
> Does this work for you?
>
> Regards
> Sander
>
--
You received this message because you are subscribed to the Google Groups
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.