I have a filter which turns hashtags into links:
app.filter('hashtags', function($filter) {
return function(text, target) {
if (!text) return text;
var replacedText = text.replace(/#(\w*[a-zA-Z_]+\w*)/gim, '<a ng-href="/posts?q=%23$1">#$1</a>');
return replacedText;
};
});
However, when it is displayed on the page, the hashtag is clickable and surrounded in anchor tags, but the ng-href is no where to be found. It looks like this.
<a>#hashtag</a>
Why is the angular directive not showing up?
It may be worth noting that classes show up. If I were to change this line to read:
var replacedText = text.replace(/#(\w*[a-zA-Z_]+\w*)/gim, '<a class="test" ng-href="/posts?q=%23$1">#$1</a>');
The output in HTML would be:
<a class="test">#hashtag</a>