Expand and collapse with angular js

前端 未结 6 1655
一整个雨季
一整个雨季 2021-01-31 18:53

I am trying to figure out a way to do an expand and collapse using angular js. I haven\'t been able to find an elegant way to do this without manipulating dom objects in the con

6条回答
  •  既然无缘
    2021-01-31 19:15

    You can solve this fully in the html:

    Title
    Only shown when checkbox is clicked

    This also works well with ng-repeat since it will create a local scope for each member.

    {{m.title}}
    {{ m.content }}

    Be aware that even though a repeat has its own scope, initially it will inherit the value from collapse from super scopes. This allows you to set the initial value in one place but it can be surprising.

    You can of course restyle the checkbox. See http://jsfiddle.net/azD5m/5/

    Updated fiddle: http://jsfiddle.net/azD5m/374/ Original fiddle used closing tags to add the HTML text label instead of using tags.

提交回复
热议问题