指令元素不在标记中显示指令名称

时间:2015-03-23 17:13:30

标签: angularjs angular-directive

我想隐藏我的html

中的指令名称标记

现在我正在做这个

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

但是当渲染/编译时我只想显示指令的内容。不是实际的<option-found-address-display>,而是我的内容。

我很确定我看到了如何隐藏这个但不记得的方法

1 个答案:

答案 0 :(得分:2)

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

将隐藏html中的指令名称标记。

Replace:true可以解决问题。

For more about replace:true