I have a requirement to remove a class name dynamically via js.
The reason to do so is that I’m trying to remove the icon of sorting a specific column from a table.
When I inspect the element – I see I have ng-class with the same class name as the class attribute.
I don’t have any access to the angular file – since it’s a third-party app, but I can write some JS in it.
<th title="" ng-repeat="$column in $columns" ng-class="{
'sortable': $column.sortable(this),
'sort-asc': params.sorting()[$column.sortable(this)]=='asc',
'sort-desc': params.sorting()[$column.sortable(this)]=='desc'
}" class="col_poi_Id_356 sortable">
</th>
When I’m removing the “sortable” from the class manually from the developer console – It works great.
But when I’m trying to do: element.remove("sortable");
it removes the “sortable” both from the class and from the ng-class and its causes unwanted behavior.
I want to remove a class name only from the class attribute without touching the ng-class.
is that possible?
I don’t have much knowledge in JS, but I tried to find a solution on the google but didn’t find one.
any help, including links, will be much appreciated.
Thanks!