Is there a way to do a ng-hide on a html div?

后端 未结 4 1967
佛祖请我去吃肉
佛祖请我去吃肉 2021-01-24 03:53

I am trying to hide my div that has id=\"crossfade\" where there is an ng-click event.

1) Is this possible? 2) What am I doing wrong?



        
4条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-24 04:53

    It's a little hard to figure out exactly what is wrong without seeing the getData function but from what I can see, heres some suggestions

    Firstly, never bind to a function, its hard to debug and its costly performance wise.

    Here is a solution that will work. I'd suggest either hard coding properties for each item or use an array. I've used a single property here for simplicity.

    HTML

    # ...

    JS

    swimwearVisible = false;
    
    showSwimwear(){
        this.swimwearVisible = !this.swimwearVisible;
    }
    

    All being well the div will show and hide when you click the link. It'll also show the current state to help you debug.

提交回复
热议问题