How to use `replace` of directive definition?

后端 未结 4 1900
执笔经年
执笔经年 2020-12-02 09:27

In this document: http://docs.angularjs.org/guide/directive , it says that there is a replace configuration for directives:

templ

4条回答
  •  猫巷女王i
    2020-12-02 10:26

    As the documentation states, 'replace' determines whether the current element is replaced by the directive. The other option is whether it is just added to as a child basically. If you look at the source of your plnkr, notice that for the second directive where replace is false that the div tag is still there. For the first directive it is not.

    First result:

    directive template1
    

    Second result:

    directive template2

提交回复
热议问题