In this example if we double click on the text it will change the color of text because true value is assigned to ng-class and vice versa.

<!DOCTYPE html> <html xmlns=""> <head> <style type="text/css"> .red { color: red; } </style> <title>Welcome to LearnKode - A code learning platform</title> <script src=""></script> </head> <body ng-app> <div> <p ng-dblclick="isColor=!isColor" ng-class="{red:isColor}">Double-click me to change my text color.</p> </div> </body> </html>