Questions tagged [transclusion]

transclusion (verb: transclude) is a feature in multiple platforms allowing embedding of content from other sources.

Resources:

207 questions
450
votes
17 answers

How can I include a YAML file inside another?

So I have two YAML files, "A" and "B" and I want the contents of A to be inserted inside B, either spliced into the existing data structure, like an array, or as a child of an element, like the value for a certain hash key. Is this possible at all?…
kch
  • 77,385
  • 46
  • 136
  • 148
284
votes
3 answers

What is ng-transclude?

I have seen a number of questions on StackOverflow discussing ng-transclude, but none explaining in layman's terms what it is. The description in the documentation is as follows: Directive that marks the insertion point for the transcluded DOM of…
Code Whisperer
  • 22,959
  • 20
  • 67
  • 85
223
votes
3 answers

React.js: Wrapping one component into another

Many template languages have "slots" or "yield" statements, that allow to do some sort of inversion of control to wrap one template inside of another. Angular has "transclude" option. Ruby/Rails has yield statement. If React.js had yield statement,…
NVI
  • 14,907
  • 16
  • 65
  • 104
209
votes
10 answers

how to reference a YAML "setting" from elsewhere in the same YAML file?

I have the following YAML: paths: patha: /path/to/root/a pathb: /path/to/root/b pathc: /path/to/root/c How can I "normalise" this, by removing /path/to/root/ from the three paths, and have it as its own setting, something like: paths: root:…
Andrew Bullock
  • 36,616
  • 34
  • 155
  • 231
111
votes
8 answers

Batch file include external file for variables

I have a batch file and I want to include an external file containing some variables (say configuration variables). Is it possible?
Pablo
  • 28,133
  • 34
  • 125
  • 215
45
votes
6 answers

Check if template exists before rendering

is there a way to check if twig template exists before calling to render? A try catch block seems not to work, at least in dev environment, and plus, I prefer a check than the cost of an exception. This class TwigEngine has an exists() method, but…
K. Weber
  • 2,643
  • 5
  • 45
  • 77
38
votes
3 answers

How to check whether ng-content exists

Suppose i have simple Bootstrap panel component with multiple transclusion slots. Template example:
hendrix
  • 3,364
  • 8
  • 31
  • 46
22
votes
5 answers

Is there a vue.js equivalent of ngTemplateOutlet?

Does vue.js have an equivalent of Angular's *ngTemplateOutlet directive? Let's say I have some components defined like this:
asker11660
  • 221
  • 2
  • 3
22
votes
1 answer

Optional two-way binding on isolate scope for Angular Directive

question I just learned that you can have an optional 'reverse' or callback binding via: scope: { parentScopeFunc: '&?' } I'm trying to see if there is a way to do something similar with the 2-way binding. scope: { optional2WayBoundProp: '=?'…
jusopi
  • 6,791
  • 2
  • 33
  • 44
22
votes
1 answer

Get original transcluded content within angular directive

My goal is to create an editable directive that allows a user to edit HTML of any element to which the attribute is attached (see Plunker: http://plnkr.co/edit/nIrr9Lu0PZN2PdnhQOC6) This almost works except I can't get the original raw HTML of the…
prototype
  • 7,249
  • 15
  • 60
  • 94
11
votes
2 answers

Passing a binding to transcluded scope in component

In AngularJS 1.5, I want to pass a binding from a component into the (multi-slot) transcluded scope - for a reference in the template (in either one specific or all of them - no either way is fine). This is for creating a generic custom-select list…
11
votes
1 answer

YAML reference another variable in another file

Suppose I have 2 YAML files: 1) application.yml en: variable: "Hello World" 2) user.yml en: variable: "Hello World" > At first I though that I might use referencing: 1) application.yml en: …
Dmitri
  • 2,451
  • 6
  • 35
  • 55
11
votes
2 answers

AngularJS : ng-controller on directive does not work on transcluded elements within directive

Here is my script: angular.module('MyApp',[]) .directive('mySalutation',function(){ return { restrict:'E', scope:true, replace:true, transclude:true, template:'
Hello
', …
Engineer
  • 47,849
  • 12
  • 88
  • 91
11
votes
4 answers

Angular.js & Adsense

I'm trying to put ads on my angular.js app, and I've done some reading and discovered it isn't possible to just copy and paste the normal adsense code. I've heard you are supposed to "wrap it in a directive with a transclusion," and the only example…
David Litwak
  • 111
  • 1
  • 1
  • 3
11
votes
6 answers

How to hide element if transcluded contents are empty?

I created a very simple directive which displays a key/value pair. I would like to be able to automatically hide the element if the transcluded content is empty (either zero length or just whitespace). I cannot figure out how to access the content…
jessegavin
  • 74,067
  • 28
  • 136
  • 164
1
2 3
13 14