Questions tagged [angular2-ngcontent]

94 questions
1
vote
1 answer

@Host() without in Angular2 not working

I'm trying to limit the search of my dependencies to only its host by using @Host. But it's not working without ng-content or transclusion. The below code is not working(without ng-content) // Root Component @Component({ selector:…
Rishi Tiwari
  • 1,041
  • 1
  • 10
  • 20
1
vote
1 answer

Angular 2 - Accessing content and events from ng-content projection in child component

I am making a sidebar in angular2. Code: Sidebar (child) component's template: Parent component's template:
  • Menu-item
  • 1
    vote
    1 answer

    How to compile dynamic template in ng-content in angular 2

    I am trying to extend/wrap a third party(Angular Material 2) directive by writing a custom component/directive. For a button, Instead of using above control directly at all places in my…
    1
    vote
    1 answer

    Angular2 ng-content scss nested styles and StyleUrls not working when using :host

    I am building a component which uses ng-content and I have found that I cannot use nested scss or the StylesUrl when I use the :host >>> For instance : :host >>> .toolbar-brand{ color: red; font-weight: 500; text-decoration: none; font-size:…
    jonnie
    • 12,260
    • 16
    • 54
    • 91
    1
    vote
    0 answers

    How to get a reference to transcluded content

    I am trying to implement a DropdownComponent, which will allow a transcluded button (or any other suitable element or an Angular component) to trigger dropdown, and a transcluded div for content that needs to be displayed in the dropdown. Usage of…
    0
    votes
    0 answers

    ControlValueAccessor inside ng-content

    I prepared a simple example when we have 2 ColorPickerComponent. One is rendered directly on the App component, one is pushed down the tree as a child to be projected inside WrapperComponent First one works fine:
    Eatos
    • 444
    • 4
    • 12
    0
    votes
    1 answer

    How to render a component in the center of the screen? - Angular

    I'm doing this project with what I'm learning about angular. Now I'm in doubt about what would be the best way to render a component within this main component. repo: https://github.com/jrsbaum/crud-angular demo:…
    0
    votes
    2 answers

    Angular component ng-content passing template with dynamic output placeholders

    Is it possible to have a component that can handle dynamic projection like this?

    This date falls on a ! It is on week number of year

    user2268244
    • 244
    • 1
    • 15
    0
    votes
    1 answer

    Use to pass HTML from parent component and display in a modal component

    I have a modal component in which is getting used in different modules. To make it dynamic, I need to pass design from a parent component from where I am calling the modal. I tried to use ng-content to pass the design but since its a modal…
    Arjun
    • 1,294
    • 13
    • 24
    0
    votes
    2 answers

    How can I use an ngFor directive inside ng-content?

    I'm trying to display an array of items using an angular material expansion panel and it's not displaying anything. I know the expansion panel uses ng-content to project content into the panel component. Here's what my template code looks…
    0
    votes
    1 answer

    Angular same component different templates

    How can i reuse one component with different content in it. I have component quick-links that extends dashboard-panel component and has title and content. I want to reuse that quick-links component with different title and content
    0
    votes
    1 answer

    ng-content and tooglable text centered

    i need my ng content and text to align to center this is the current situation:
    0
    votes
    0 answers

    Component inside ng-content not load with custom Element Angular

    I'm having a little problem with Angular Elements, here an exemple : I have custom element with this selector "custom" and this template : I have a component (not custom) with this selector "component" and this template…
    0
    votes
    0 answers

    How can I pass a component to ng-content in Angular?

    I am trying to find a simple way of nesting a component in another component, by referencing it inside the content area of the parent component. This would be the parent: @Component({ selector: 'app-foo', template: `
    bparticle
    • 147
    • 1
    • 1
    • 8
    0
    votes
    1 answer

    Filtering Child Content in Angular 2+

    I have two Angular components (accordion > expansion panels) that I need to write without a framework. I am using ContentChild to support all of the expansion panels contained within the accordion component. What I want to do is parse the components…
    AlphaG33k
    • 1,588
    • 1
    • 12
    • 24