Wednesday 5 November 2014

Transclude explained

Combination of transfer and include, this simply means you want to take the HTML within the usage of your directive and include it within the template supplied by your directive definition.

image

The key lines are 14, 18 and 30.  These tell Angular I want to transfer the contents of the HTML DOM and here is where I want to include it.  Line 30 is the usage of the directive including the {{text}} which is transcluded.

 

 

image

No comments:

Post a Comment