Understanding the transclude option of directive definition?

后端 未结 6 1521
醉话见心
醉话见心 2020-12-02 03:28

I think this is one of the hardest concept for me to understand with angularjs\'s directive.

The document from http://docs.angularjs.org/guide/directive says:

<
6条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-02 04:17

    transclude:true mean to add all element that is defined in your directive with template element of your directive.

    if transclude:false the these elements are not included in your final html of directive only template of directive is rendered.

    transclude:element mean your directive template is not used only element defined in your directive are rendered as html.

    when you define your directive then it should be restrict to E and when you add it on page then

    
     is like 

    gratitude

    what i am talking about.

提交回复
热议问题