Did you ever find a solution to this problem? I have posted a similar
question, but different approach, on Stack Overflow at
http://stackoverflow.com/questions/22047917/how-to-create-ssl-connections-for-specific-operations-but-still-allow-http-for
.
Thanks...
On Sunday, April 7, 2013 12:27:18 PM UTC-4, Gihan S wrote:
> Hi All,
>
> In my angular app some parts need to be used on https, such as login. I
> have configured routes as follows
>
> $routeProvider.
> when('/', {
> controller:HomeCtrl,
> templateUrl:'partials/home.html'
> }).
> when('/my-account',
> controller:MyAccountCtrl,
> templateUrl:'partials/my-account.html',
> auth:true
> ).
> when('/login', {
> controller:LoginCtrl,
> templateUrl:'partials/login.html',
> });
>
> and I have setup a $routeChangeStart listner to to detect auth required
> pages and redirect to https login page from there
>
> $rootScope.$on('$routeChangeStart', function(event, next, current) {
> var auth = next.auth || false;
> var host = $location.host();
> if (auth && !User.isAuthenticated()) {
> window.location.href = 'https://'+host+'/#/login'; //throws
> errors here
> }
>
> But when I do this it throws bunch of errors saying
>
> Error: 10 $digest() iterations reached. Aborting!
>
> I know I have to use *$rootScope.$$phase || $rootScope.$apply();* to skip
> this errors. But it doesn't help here
> So anybody knows a better way to switch to https from http
>
> Thank you for looking at this issue.
> Cheers !
>
--
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/groups/opt_out.