We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Given the url to linkify:
https://www.site.com/someimage.jpg?var=1&option=1
The href attribute for the <a> tag has some characters (&) escaped to html entities.
href
<a>
https://www.site.com/someimage.jpg?var=1&option=1
This way the url cannot be achieved. I suggest unescaping it back when adding the attribute do the tag.
The text was updated successfully, but these errors were encountered:
Want to submit a PR?
Sorry, something went wrong.
Actually I realize a simpler solution for my case, and created own directive. The regex is kind of different and more like the facebook one's
appDirectives.directive('linkify', ['$timeout', function($timeout){ return { restrict: 'A', replace: true, link: function(scope, element, attrs){ var linkify = function(text){ if (text) { text = text.replace( /((https?\:\/\/)|(www\.))(\S+)(\w{2,4})(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/gi, function(url){ var full_url = url; if (!full_url.match('^https?:\/\/')) { full_url = 'http://' + full_url; } return '<a target="_blank" href="' + full_url + '">' + url + '</a>'; } ); } return text; }; $timeout(function() { element.html(linkify(element.text())); }); } }; }])
Would this be useful in this directive? Should we use that regex?
No branches or pull requests
Given the url to linkify:
https://www.site.com/someimage.jpg?var=1&option=1
The
href
attribute for the<a>
tag has some characters (&) escaped to html entities.https://www.site.com/someimage.jpg?var=1&option=1
This way the url cannot be achieved. I suggest unescaping it back when adding the attribute do the tag.
The text was updated successfully, but these errors were encountered: