Skip to content
Related Articles

Related Articles

Improve Article

AngularJS | ng-open Directive

  • Last Updated : 28 Mar, 2019
Geek Week

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.


<element ng-open="expression"> Contents... <element>

Example: This example uses ng-open Directive to open attribute of an element.

<!DOCTYPE html>
    <title>ng-open Directive</title>
    <script src=
<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>

Before Clicking the element:
After Clicking the element:

My Personal Notes arrow_drop_up
Recommended Articles
Page :