Last active
August 29, 2015 13:55
-
-
Save cesarandreu/8762652 to your computer and use it in GitHub Desktop.
Lets you set anchor tags that cause a full page reload instead of letting ngRoute handle the page-change
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- This link will be handled by ngRoute --> | |
<a href="/angularpage">AngularJS Link</a> | |
<!-- With directive, this link will cause a full page load and may be handled by your server --> | |
<a href="/railspage" trd-external>Rails Link</a> | |
<!-- Manually, this link will cause a full page load and may be handled by your server --> | |
<a href="/railspage" target="_self">Rails Link</a> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.module('tdConsoleApp') | |
.directive('trdExternal', function () { | |
'use strict'; | |
return { | |
restrict: 'A', | |
link: function (scope, iElement) { | |
iElement.attr('target', '_self'); | |
} | |
}; | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment