Featuring multiple elements with an ng-class that behaves similarly to a ternary operator:
ng-class="$ctrl.something ? 'fa-minus' : 'fa-plus'"
To access these elements, we can compile all the ones with fa-minus
and store them in a list:
const elementList = document.querySelectorAll('.fa-minus');
I am wondering if it's possible to alter the contents of ng-class. For instance, changing all instances of fa-minus
to fa-square
.
I have attempted various methods like removing and adding classes:
const elementList = document.querySelectorAll('.fa-minus');
document.forEach(document=> document.classList.remove('.fa-minus'));
document.forEach(document=> document.classList.add('fa-square'));
This approach didn't work, presumably due to the original being defined within an ng-class rather than a traditional CSS class.
The goal is not to edit the original ng-class, but to modify it only within a function that generates an export file
Is there a solution to this issue?