Skip to content
Related Articles

Related Articles

Improve Article
AngularJS | ng-open Directive
  • Last Updated : 28 Mar, 2019

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>                    

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

My Personal Notes arrow_drop_up
Recommended Articles
Page :