Ok. So here is a noob question. I just started fooling around with angularjs and I was wondering if there is some sort of toggle function similar to ng-click or I have to build my own. What I want is to change the background and the font color of the body of my page, when the user checks the dark theme option.
I managed to change the color on the click function but I need it to come back to initial state when it is not checked. Any suggestions are welcome:)
<!DOCTYPE html>
<html>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>
<body ng-app="myApp" ng-style="myStyle">
<label><input type="checkbox" ng-click="myStyle={background:'black', color:'white'}">Dark theme</label>
<script>
app = angular.module('myApp', []);
</script>
</body>
</html>