Full page reload links

3,350 views
Skip to first unread message

Glen

unread,
May 31, 2012, 11:19:20 PM5/31/12
to AngularJS
Hi, my login buttons for my app are of the sort '/users/auth/
facebook' (using rails + devise + omniauth), but by default Angular is
catching those links and rewriting the location bar without a round
trip to the server. I've been able to get this to work using the
following code:

HTML:

<a href ng-click="externalLink('/users/auth/facebook')">Sign in</a>

Controller method:

$scope.externalLink = function(href) {
return $window.location.href = href;
};


But I was wondering if there was a neater way. I'd like the HTML to
look something like this:

<a href='/users/auth/facebook' ng-no-intercept>Sign in</a>


Is there such a thing?

Alex Nertus

unread,
Jun 1, 2012, 7:21:28 AM6/1/12
to AngularJS
$location.absUrl();

Glen Maddern

unread,
Jun 4, 2012, 2:30:22 AM6/4/12
to ang...@googlegroups.com
I don't think that's right. The docs say that absUrl() is a getter only. What I'm after is a neat way to cause a full page reload.

$location.absUrl();
--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To post to this group, send email to ang...@googlegroups.com.
To unsubscribe from this group, send email to angular+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/angular?hl=en.


Misko Hevery

unread,
Jun 6, 2012, 8:57:29 PM6/6/12
to ang...@googlegroups.com
window.location.reload() not working?

Glen Maddern

unread,
Jun 6, 2012, 9:00:17 PM6/6/12
to ang...@googlegroups.com
It works, I was just hoping there might be another way. Defining $scope.externalLink(url) isn't too bad.
Reply all
Reply to author
Forward
0 new messages