m.nourzadeh
m.nourzadeh

Reputation: 1

AngularJS remove href

I want to remove href attribute from 'a' tag (work like a plain text) and I use this code in my directive file:

.directive('rhHasLinkFor', function () {
    return{
        priority: 10000,
        restrict: 'A',
        compile: function (el, attr) {
                el.href.remove();

        }

    }
});

but it doesnt work,what's the problem?

Upvotes: 0

Views: 690

Answers (1)

gorpacrate
gorpacrate

Reputation: 5561

Try

.directive('rhHasLinkFor', function () {
    return{
        priority: 10000,
        restrict: 'A',
        compile: function (el, attr) {
                el.removeAttr('href');
        }

    }
});

Upvotes: 2

Related Questions