Im using ng-class to apply the class active when collapseSidebar is set to true revealing my sidebar.
<div class="row full-height row-offcanvas row-offcanvas-left" ng-class="{active: collapseSidebar}">
<div id="sidebar" class="col-sm-4 col-md-3 col-lg-3 col-xl-2 sidebar-offcanvas">
</div>
js
$scope.collapseSidebar = false;
$scope.select = function(thing)
{
$scope.selectedThing = (thing !== $scope.selectedThing) ? thing : null;
$scope.collapseSidebar = true;
};
However the sidebar can be hidden in other ways (click a menu icon in the top left) removing the class active. When I call select(thing) I was hoping that ng-class would be re-evaluated and the class 'active' would be re-applied, however this does not happen, I have tried setting it to false and then straight back to true which also didn't work.
How can I get ng-class to re-evaluate collapseSidebar and apply 'active' even if the value is the same as be
Have you tried:
ng-class="{'active': collapseSidebar}"
(The active class name is wrapped by the "'" characters)