Hi Gabriel,
I looked around a bit and found <https://github.com/gregjacobs/Autolinker.js>
which can create links from URLs, email addresses and Twitter handles. I
wrapped it in a directive like this:
.directive('autolinker', function () {
return {
restrict: 'E',
scope: {
text: '='
},
link: function (scope, element, attrs) {
scope.$watch("text", function (new_value) {
if (new_value != undefined) {
element.html(Autolinker.link(new_value, {email: false, twitter: false}));
}
})
}
}
})
Pertti
On Wed, Apr 23, 2014 at 12:04 PM, Gabriel Aszalos <[email protected]
> wrote:
> P.S. You could also use RegEx to do that.
>
>
> On Tuesday, 22 April 2014 14:42:58 UTC+1, Pertti Kellomäki wrote:
>
>> Does anyone happen to have a directive handy that would render a string
>> as plain text, but turn URLs into links?
>> --
>> Pertti
>>
>> --
> 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.
>
--
Pertti Kellomäki, Kesanto Enterprises
Your training in the cloud: <http://www.trainingcommons.com>
--
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.