JSFiddle - React, Tailwind, and code Playground
HTML
<script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.1/angular-sanitize.min.js"></script>
<div ng-app="myApp">
<p ng-controller="Example" ng-bind-html="post | autolink"></p>
</div>
JavaScript
angular.module('myApp', ['ngSanitize']).filter('autolink', [function () {
var link = '<a href="http://airstream.com/$1">$1</a>',
list = [/\B(@[\w]*)/g, /\B(#[\w]*)/g];
return function (text) {
angular.forEach(list, function (regex) {
text = text.replace(regex, link);
});
return text;
};
}]);
function Example($scope) {
$scope.post = "Just finished writing sadfasdfasa #jQuery to #AngularJS comparison and migration walkthrough for @airpair!";
}