I am new on AngularJs and I have a doubt about how angular render the ng-class attribute.
Working with external libraries (visualization, charts, ...) I need to trigger frequently the resize event:
window.dispatchEvent(new Event('resize'));
Eg: Charts inside a container that changes its size in fullscreen, charts inside a modal dialog...
When I do something like that in my controller:
$scope.fullscreen = true;
window.dispatchEvent(new Event('resize'));
console.log($('#mycontainer').height());
And in my template:
<style>
#mycontainer {
width: 100px;
height: 100px;
background-color: orange;
color: white;
}
.fullscreen {
width: 100%;
height: 100%;
position: fixed;
top: 0;
left: 0;
z-index: 99;
}
</style>
(...)
<div id="mycontainer" ng-class="{'fullscreen': fullscreen}">
content here
</div>
console.log prints the old size without apply the class fullscreen.
Is there any way to render ng-class inside a controller or force apply a class without use the JQuery .addClass method?
Fiddle example: https://jsfiddle.net/Garet/d9c7ux3j/2/