akveo / nebular

:boom: Customizable Angular UI Library based on Eva Design System :new_moon_with_face::sparkles:Dark Mode
https://akveo.github.io/nebular
MIT License
8.06k stars 1.51k forks source link

nb-list is not accepting ng-container #2468

Open arunachalam-github opened 4 years ago

arunachalam-github commented 4 years ago

**I'm submitting a bug report

Issue description

Current behavior: nb-list is not supporting any wrapper around it. I’m trying to have more than one structural directive on the same element.

` <ng-container ngFor="let card of cards"> <nb-list-item ngIf="card.groupId == group.id" cdkDrag id="{{card.id}}">

 {{ card.name }} ` **Expected behavior:** The system should allow wrapper around nb-list and render ng-container or ng-template. I even tried editing NgComponentSelectors in list.component.d.ts to support all wrapper. `static ɵcmp: ɵngcc0.ɵɵComponentDefWithMeta;`
AgentKith commented 3 years ago

Having the same issue here. Need to use ngFor to loop through, and then a ngIf to select the items I want but can't do it because nb-list don't support ng-container or even ng-template.

Tried to hack it with [style.visibility] but that just leaves an empty void.

Currently doing a workaround creating a new list just to get it going. Would be nice if nb-list is updated to work with ng-container so I can do both ngFor and ngIf.

AgentKith commented 3 years ago

Never mind. Created a pipe to filter out things I don't need and that works.

Some discussion on this here: https://stackoverflow.com/questions/34164413/how-to-apply-filters-to-ngfor

dalepo commented 2 years ago

Came across this issue... It's a basic use case to render different items or even custom components within a nb-list For example

<nb-list>
    <my-custom-component></my-custom-component>
</nb-list>

My component.html

<nb-list-item> This is custom </nb-list-item>

It won't work, would love to see it working though.

Now that I've seen, nb-list-item also doesn't project ng-container or ng-template. I find this library difficult to use if it doesn't support basic angular directives.

hillin commented 2 years ago

This is annoying, we have to filter the list items from the component's code behind.

DiegoAndresCortes commented 1 year ago

Looks like nb-radio-group doesn't support this either