New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Accordion : Work with dynamic CSS class #2262
Comments
The closest thing we've got is the |
Based on your indications, I try to set conditions in my loop in order to switch between two ngb-panel, one with a success type and another type of danger. So when I click on the preselected item in green, the project reloaded. This is when I want to splice a table of preselected item for the ngb-panel condition. ** Here is the Plunker for the demo: ** http://plnkr.co/edit/ypK891VsZ6CnGjWKe1ir?p=preview
So I have functions that allow me to retrieve a list of preselected item
When I click on a panel, the function I call This function splice the preselected item (example: id 0 became 1). like that:
|
I have made some modifications on this Plunker: http://plnkr.co/edit/9ymXORzF63M67nNXy0xd?p=preview So now when I click on an item, I trying to change the value of the preselected item list by id position.
If u try the Plunker, when u clicking on the item at position 1 into Platform Upgrade Option (the second item on the view = Intel® Core™ i5-6300U vPro™ Processor 2.4GHz). Finally if u click on an other item (for example the third item of the list) all works fine, the item at position 1 going to be in green. So if u change |
It is a bit hard to investigate for me as I don't fully understand what you are trying to do exactly but I don't think you should have if / else around panels as this will re-create them and give the "reload" impression. What you should be doing instead is to bind to panel properties and change their type / disabled flag based on your mode. In short - use bindings instead of if / else. |
Here is an example of the result I want to optain but with Angular Material: When I click on an item, I change the preselected id list and so the css class became active. But with ngb how can we make something like that ? |
I also want to use ngClass or ngStyle for the same reason. Add additional styles on opened tabs... |
Bug description:
I want the panels to be clickable but without content.
The idea would be to retrieve the panel that I just click / select in order to pass it in active class and change its color to differentiate it from others.
And of course if I click on another panel, disable / deselect the one that was active before.
So I try to work with dynamic classes in a ngb panel selector but without the
[disable] =" true "
entry.When I click on a panel, I print it in the console (example Plunker). Which allows me to identify it.
I tried a lot of things like:
[class.active]="true == this.tabSelected.indexOf(item.id) > -1"
[ngClass]="'selected'"
[class.first-item]="first" [class.last-item]="last"
Into following example:
I tried to use
[ngClass] = 'selected'
in ngb-accordion selector and the css class was changed by "selected".But nothing to do at the level of ngb-panel selector, the css class still the same.
I don't know if it's possible to do something like that.
You can fork a plunker from one of our demos and use it as a starting point.
Please note that we can not act on bug reports without a minimal reproduction scenario in plunker. Here is why:
http://plnkr.co/edit/agr9Oe3RN01sn9UeWJ3m?p=preview
Version of Angular, ng-bootstrap, and Bootstrap:
Angular: 5.2.5
ng-bootstrap: 1.0.4
The text was updated successfully, but these errors were encountered: