javascript - Can AngularJS directive ngOpen be used for an accordion component? -
what point of angularjs directive ngopen aside using details tag?
i'm trying create accordion component , came not sure if helps considering haven't been able use other details tag.
<body ng-app=""> check me check multiple: <input type="checkbox" ng-model="open"><br/> <details id="details" ng-open="open"> <summary>show/hide me</summary> </details> </body>
the purpose of ngopen
directive preserve open attribute, used details element.
from docs:
the html specification not require browsers preserve values of boolean attributes such open. (their presence means true , absence means false.) if put angular interpolation expression such attribute binding information lost when browser removes attribute. ngopen directive solves problem open attribute. complementary directive not removed browser , provides permanent reliable place store binding information.
neither open
nor details
specific angular. valid html:
<details open> <summary>section header</summary> section content </details>
angular added ngopen binding.
note: experimental feature , not supported in browsers
p.s. if you're looking implement accordion or collapse functionality, recommend using bootstrap ui offers angular directives both work across browsers.
Comments
Post a Comment