Questions tagged [angular2-ngcontent]

94 questions
3
votes
1 answer

Can Angular 4 have dynamic ng-content with dynamic select

Can angular 4 have dynamic ng-content. Can some provide a way to remove static slide1,slide2 so that it can be implemented by *ngFor Content of child component:
Mantu Nigam
  • 3,690
  • 7
  • 24
  • 41
3
votes
1 answer

How to eliminate inner component when using ng-content

I'm trying to factor out popup menus so I can write this: Edit input Edit mappings Show agent…
Isvara
  • 3,403
  • 1
  • 28
  • 42
3
votes
0 answers

Angular 2: How to add Projectable Nodes after component is dynamically created

I'm making a Tab View that can dynamically create tabs from a list of components. Also after those components have been added to the DOM I would like to be able to add them with a button. Thanks to the help from the user, yurzui, I was able to …
Erik R
  • 201
  • 1
  • 15
2
votes
0 answers

How to project content of component by some statement (e.g. by input value)

I'm working on the implementation custom table and faced with an issue. I cannot correctly project column-component content inside table-component. table.component.ts: @Component({ selector: 'app-table', template: ` ... …
Art Olshansky
  • 3,032
  • 1
  • 19
  • 25
2
votes
1 answer

ng-content inside ng-template always creates content even if the template is not rendered

I am facing a strange bug with a ng-content wrapped in a ng-template. Let's say I have a component inner-component which I display within a outer-component:
2
votes
1 answer

Angular 9+: nested ng-content and ContentChildren

I'm trying to capture the content of an outer ng-content with ContentChildren, with no luck. Here's the code: app.component.html:
Etchelon
  • 832
  • 11
  • 27
2
votes
1 answer

Angular doesn't render second

I am trying to build a 'SmartLinkComponent' that can distinguish between internal and external links and at the same time, can wrap any html content in tag. I came up with the following solution (smart-link.component.html):
vanomart
  • 1,739
  • 1
  • 18
  • 39
2
votes
2 answers

Using ngContent within ngFor for different objects

I have a component: @Component({ selector: 'app-my-component', templateUrl: './my-component.html' }) export class MyComponentComponent { @Input() values; }
When using…
Sun
  • 4,458
  • 14
  • 66
  • 108
2
votes
1 answer

ng-content in form tag

I have a form component with tag inside and btn that currently does nothing. Also I have a parent component that use it with simple input as content projection. The problem is, whenever I click on the button, both parent and…
2
votes
0 answers

Angular2: Bind with child component through ng-content

I try to make a few components that work together for my app. Short explanation: My goal is to set a property on the tile component which then is used in the child…
LittleOne
  • 1,077
  • 1
  • 11
  • 21
2
votes
2 answers

Angular2 check/detect ng-content select exist from parent node *ngIf statement

My question is about checking that connected with was given or not in parent component. May be I give example for clarify: We have parent component template (editor.html): Here is my…
Kamil Kiełczewski
  • 85,173
  • 29
  • 368
  • 345
1
vote
1 answer

How to use ContentChild with ng-content without specifying the exact class of the content projected component?

I'm trying to create a general purpose container component for all tables so they all have same headers (possible buttons, filter-chips, search-field). I'm planning to use content projection with ng-content and passing data to the table using…
char m
  • 7,840
  • 14
  • 68
  • 117
1
vote
1 answer

JavaScript Command document.getElementsByClassName not working on special page

I am currently writing a bot to fetch data from a web live ticker. Therefore i created an app, that displays the webbrowser using Python QWebEngineView. Now if i want to get a special Value from the html code of the site i am currenty…
1
vote
4 answers

How to remove parent element if ng-content is empty

I want to hide remove div.parent if ng-content is empty from bellow code
I tried using reference like bellow, but seems to be not working
Cipher
  • 2,060
  • 3
  • 30
  • 58
1
vote
0 answers

Angular - ng-content from grandparent to child

I'm creating a set of bespoke form components in Angular 9. One of which is an Account Dropdown which uses another component Dropdown List within its template. The Dropdown List component already has logic which uses content-projection (ng-content)…
James Howell
  • 1,392
  • 5
  • 24
  • 42