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.



filter_none

edit
close

play_arrow

link
brightness_4
code

<!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


Output:
Before Clicking the element:
ngopen
After Clicking the element:
ngopen



My Personal Notes arrow_drop_up


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.