Lighthouse Nguyen Lighthouse Nguyen - 5 months ago 45
AngularJS Question

Angularjs directive with dynamic template and transclude

I'm trying add a dynamic template and met problem with transclude.

This is dynamic template function:

var getTemplate = function(contentType){
var template = '<button style="cursor: pointer;">' + contentType + '<ng-transclude></ng-transclude></button>'
return template;

And this is code to call the dynamic template:


Look at full code here

Please help me to fix it.

This is docs i used: docs

Thank you very much.


In the plunkr the path to angular script was not found. Changing to <script src="//"></script> worked