Pallavi Sharma
Pallavi Sharma

Reputation: 655

why ng-transclude not working in angular js as expected

I make a simple directed with isolated scope .I read the tutorial of transclude but when I apply it not working as expected .I need to show "dd" and test together how I can show this here is my plunker http://plnkr.co/edit/OxmVga7DdkNxzPnfDtGS?p=preview

 var app =angular.module('app',[]);
  app.directive('newdir',function(){
    return {
      restrict:"E",
      scope:{
        fr:'@'
      },
      replace:true,
    transclude: true, // we want to insert custom content inside the directive
      template:"<div ng-transclude >{{fr}}</div>"

    }
  }); 

Upvotes: 0

Views: 1457

Answers (1)

Jason Goemaat
Jason Goemaat

Reputation: 29214

The transcluded element gets completely replaced. Replace your template with this to see what is happening:

<div><h3>BEFORE</h3><h1 ng-transclude>MISSING</h1><h3>AFTER</h3>{{fr}}</div>

Upvotes: 1

Related Questions