1
I need to change the style of an element when clicked and if you click again it goes back to the color it was (as if it were an "advanced search"). I have the following code:
<a href="" class="corCinza" ng-click="exibirForm = !exibirForm">...</a>
<div class="filtro" ng-show="exibirForm">
<form ... />
</>
When I click on <a>
it has to stay with corazul and open the div with the form. If I click again it closes the div of the form and returns to corCinza.
The form is already working, but I could not change the color.
I tried to use ng-class as a "tutorial" but it didn’t work.
Can someone help me?
P.S.: I just "program" html and css. The most I coded was a simple helloWorld in JS.
Our @Celsomtrindade, I was thinking of "more complex" solutions. That worked great. Thank you!
– trofonia
Not so ;) Just remember: class defined within
class=""
is static, cannot be removed through theng-class
. Class defined within theng-class=""
will only be added toclass=""
if the condition confers.– celsomtrindade
Ook!! Thanks again! D
– trofonia
@trofonia if solved the problem, do not forget to mark the answer as accepted =D
– celsomtrindade