Search code examples
angularjsangular-directive

Directive Element Not displaying directive name in mark up


I want to hide the Directive name markup from my html

Right now I am doing this

<option-found-address-display></option-found-address-display>

But when this renders/compiles I just want to show the contents of the directive. Not the actual <option-found-address-display>and then my content within.

I am pretty sure I saw a way how to hide this but can't remember


Solution

  • app.directive('optionFoundAddressDisplay', function() {
      return {
        restrict: 'E',
        template: '<div>your content</div>',
        replace:true
      }
    });
    

    will hide the directive name markup from the html.

    Replace:true does the trick.

    For more about replace:true