-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Bug with accordion-group and ng-class #4172
Comments
I can confirm this behaviour as well. And because of this problem, the class is not added when the panel is open. |
Using ng-class on a directive that uses The best solution is to use the |
@wesleycho what do you think about adding an |
I'm not against it necessarily, but in increases cumbersomeness of usage. replace is also a potentially dangerous thing in tandem with another directive that mutates the DOM. If a PR is opened, I'll gladly review and merge it though. |
Agreed. I recall a comment in an issue in the angular codebase by @caitp indicating that while I wonder if it would be best to establish best practices (or at least "standards") on a project level and just say "If we do x, then we won't support y." In this case it could be: "Because we use |
I can get behind that, as ideally, you should avoid using directives that mutate the DOM in combination with a directive that uses One can wrap the element with a |
@wesleycho found this link via #1741. Look at @caitp's last comment. If Angular isn't going to address this, I think we can close this issue and #1741 and add a comment to the docs about not supporting certain directives on UI Bootstrap directives that use |
That settles it for me - closing as won't fix as per resolution in Angular. |
Then how can I put a custom class on each accordion group? For example, I used to use I think there are real needs for |
No one argues about it. It is just a technical solution that is missing here. If you've got an idea on how to solve it from the technical point of view, a pull request would be appreciated. |
One can use |
@wesleycho, works perfectly. Thanks! |
Can someone post example of class="customClass()}} |
@wesleycho instead of requiring the users of angular-bootstrap to read the source code and know internal implementation details (use of Rather than requiring library users to know which directives use
@icfantv With all due respect for great work on the library, in my experience issues get closed before getting feedback from the reporter, so it's quite hard not to comment on closed issues. |
@hoxu the problem here is that using ng-class is absolutely recommended against in this exact situation, so even if we did somehow allow ng-class usage here, you will unexpectedly add 4 watchers instead of the desired 1. The pain is much more preferred than allowing the user to do something carelessly unperformant. In this case, one needs to be familiar with how Going to lock discussion on this issue, as what has been said is pretty straightforward & has not been contested - there is no need for further commenting & pinging all prior users. |
Hi,
since 0.13.3 I am getting parse errors when using accordion-group in combination with ng-class. This is being caused by this change ead15e3 .
You can test this with following example:
... <accordion-group ng-class="{'test' : isTest}"> ....
This results in following generated code:
... <accordion-group ng-class="{'test' : isTest} {'panel-open': isOpen}"> ....
The text was updated successfully, but these errors were encountered: