Lighthouse Nguyen Lighthouse Nguyen - 1 year ago 87
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.

Answer Source

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download