AngularJS | ng-open Directive
The ng-open Directive in AngularJS is used to specify the open attribute of the specified HTML element. If the expression inside the ng-open directive returns true then the details will be shown otherwise they will be hidden.
Syntax:
<element ng-open="expression"> Contents... <element>
Example: This example uses ng-open Directive to open attribute of an element.
<!DOCTYPE html> <html> <head> <title>ng-open Directive</title> <script src= </script> </head> <body ng-app="" style="text-align: center"> <h1 style="color:green">GeeksforGeeks</h1> <h2>ng-open Directive</h2> <details id="details" ng-open="open"> <summary>Click to view sorting algorithms:</summary> <summary>Merge sort</summary> <summary>Quick sort</summary> <summary>Bubble sort</summary> </details> </body> </html> |
chevron_right
filter_none
Output:
Before Clicking the element:

After Clicking the element:

Recommended Posts:
- AngularJS | ng-cut Directive
- AngularJS | ng-app Directive
- AngularJS | ng-if Directive
- AngularJS | ng-value Directive
- AngularJS | ng-jq Directive
- AngularJS | ng-src Directive
- AngularJS | ng-csp Directive
- AngularJS | Directive
- AngularJS | ng-srcset Directive
- AngularJS | ng-readonly Directive
- AngularJS | ng-selected Directive
- AngularJS | ng-paste Directive
- AngularJS | ng-required Directive
- AngularJS | ng-bind Directive
- AngularJS | ng-blur Directive
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.



