forked from angular/code.angularjs.org
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathangular.directive.ng:show.html
28 lines (26 loc) · 1.36 KB
/
angular.directive.ng:show.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<h1>angular.directive.ng:show</h1>
<fieldset class="workInProgress"><legend>Work in Progress</legend>
This page is currently being revised. It might be incomplete or contain inaccuracies.</fieldset>
<h2>Description</h2>
<p>The <code>ng:show</code> and <code>ng:hide</code> allows you to show or hide a portion
of the HTML conditionally.</p><h2>Usage</h2>
<pre class="brush: js; html-script: true;"><ANY ng:show="expression">
...
</ANY></pre>
<h3>Parameters</h3>
<ul class="parameters"><li><code ng:non-bindable="">expression – {expression} – </code>
if truthy then the element is
shown or hidden respectively.</li>
</ul>
<h2>Example</h2>
<doc:example><doc:source>Click me: <input type="checkbox" name="checked"><br/>
Show: <span ng:show="checked">I show up when you checkbox is checked?</span> <br/>
Hide: <span ng:hide="checked">I hide when you checkbox is checked?</span></doc:source>
<doc:scenario>it('should check ng:show / ng:hide', function(){
expect(element('.doc-example-live span:first:hidden').count()).toEqual(1);
expect(element('.doc-example-live span:last:visible').count()).toEqual(1);
input('checked').check();
expect(element('.doc-example-live span:first:visible').count()).toEqual(1);
expect(element('.doc-example-live span:last:hidden').count()).toEqual(1);
});</doc:scenario>
</doc:example>