Questions tagged [angularjs-ng-transclude]

Directive that marks the insertion point for the transcluded DOM of the nearest parent directive that uses transclusion.

From Angularjs documentation:

Directive that marks the insertion point for the transcluded DOM of the nearest parent directive that uses transclusion.

208 questions
179
votes
3 answers

When to use transclude 'true' and transclude 'element' in Angular?

When should I use transclude: 'true' and when transclude: 'element' ? I cant find anything about transclude: 'element' in the angular docs, they are pretty confusing. I would be happy if someone could explain this in simple language. What is the…
LauroSkr
  • 2,159
  • 2
  • 15
  • 15
19
votes
1 answer

AngularJS optional ng-transclude

I have written a custom directive called 'news' in AngularJS 1.5. It's layout is as follows:
Faruk Yazici
  • 2,344
  • 18
  • 38
12
votes
1 answer

Link function after transclude in Angular js

I have two directives in Angular. One has to be trascluded in the other. My problem is that I can't access the DOM with simple JQuery selector after the transclude function has run. In particular I want to compile the first directive (topic) and…
8
votes
1 answer

How to make ngIf work after transclusion?

I have a list component where I want to define custom columns inside. These columns get transcluded into the row of the components template. Unfortunately I can't use ngIf in this context. Here is my $postLink function of the myList component: const…
Fortuna
  • 611
  • 6
  • 18
7
votes
2 answers

Multilevel transclusion in Angular 1.5

I have a generic directive, and a directive with filters and pagination tools for listing that : Example: https://plnkr.co/edit/r6byzhFX5m674ONhH1JS?p=preview The template is something like this:
Javier Marín
  • 2,166
  • 3
  • 21
  • 40
6
votes
0 answers

angularjs remove transclude wrappers from slots

I have a simple directive with transclusion slots. function wmFormControl() { return { replace: true, templateUrl: 'wm-form-control.htm', transclude: { label: '?label', hint: '?hint' } …
Kindzoku
  • 1,368
  • 1
  • 10
  • 29
6
votes
2 answers

Angular directive/child directive transclude inside ng-repeat

The problem is that child directive binds to parent however syntax {{name}} gets ignored by ng-repeat. What would be the right way achieving this? HTML (Main/child directive)
6
votes
1 answer

How to make ng-transclude behave like ng-include (in terms of scope)?

I'd like to transclude content as such that it acts as if I copy-pasted the content into the file where I write my
. How do I do this? I know I can use ng-include to include a template, and I can use script tags to define…
Pimgd
  • 5,983
  • 1
  • 30
  • 45
6
votes
1 answer

Nested - transcluded items - scope clarification?

I already know how transclusion works ( within first level only I guess) , bUt I have a question about nested transcluded item's scope. Ok so I have this code :
Royi Namir
  • 144,742
  • 138
  • 468
  • 792
6
votes
1 answer

In the transclude function of a directive link function, how is "futureParentElement" used?

In the angular documentation for the compile service (starting at line 412) there is a description of the transclude function that is passed into the linking function of a directive. The relevant part reads: function([scope], cloneLinkingFn,…
m0meni
  • 16,006
  • 16
  • 82
  • 141
6
votes
1 answer

AngularJS : How to get the uncompiled transclude content of a directive

I'm trying to use the transclude content of a directive (the original content of the directive, not the template), as the HTML template of a row in a grid. ...(html I…
cipak
  • 1,414
  • 1
  • 14
  • 20
6
votes
2 answers

AngularJS + Directive: Multiple Transcluded Elements

I'm trying to add a body directive which will have a left panel and a right panel. But in between these panels I will have some content that is private to the body directive. I'm currently using transclude=true option to load the content. But, I'm…
Alan Souza
  • 7,475
  • 10
  • 46
  • 68
5
votes
1 answer

Transclusion directives and form

I'm trying to create few directives which would wrap layout so I can abstract from that layout (which is one of the main goals of directives as I understand it). So what I would like to have is something like this:
SET001
  • 11,480
  • 6
  • 52
  • 76
5
votes
1 answer

In a named transclude slot, how do I transclude *only* the element's contents?

I've got a basic directive that I want to use transclusion. The relevant options are set up as follows: restrict: "E", replace: true, transclude: { 'toolbar': 'toolbarSlot' }, scope: { pageTitle: "@" }, templateUrl:…
5
votes
1 answer

Nested and slotted Transclude in AngularJS

I have an element which its whole content could be transcluded. the transclusion is optional, so I can let its inner parts stay but an inner element be transcluded. Let's see it in action:
rastemoh
  • 438
  • 3
  • 10
1
2 3
13 14