Angularjs toggle div visibility

前端 未结 3 1025
情话喂你
情话喂你 2021-02-02 16:31

I am trying to toggle a div text on click of a button. I tried taking a scope variable and toggeling classname based on the variable. Where am I making the mistake here



        
3条回答
  •  时光说笑
    2021-02-02 17:15

    You can simplify this a lot like so

    
    
    hello test

    Fiddle example

    Unless you need the specific ng-class to toggle in which case you can do something like

    
    
    hello test

    Fiddle example

    (just make sure you're using a newer version of angular for this)

提交回复
热议问题