Skip to content
This repository was archived by the owner on Jan 24, 2019. It is now read-only.

Commit 02b791a

Browse files
committed
Merge pull request #81 from dhbaird/uiIncludeFragment-demo
Adding demo/index.html for uiInclude.
2 parents 9435d17 + e9d0860 commit 02b791a

File tree

2 files changed

+64
-1
lines changed

2 files changed

+64
-1
lines changed

modules/include/demo/index.html

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<section id="include">
2+
<div class="page-header">
3+
<h1>Include Fragment</h1>
4+
</div>
5+
<div class="row">
6+
<div class="span6">
7+
<h3>What?</h3>
8+
<p><code>uiInclude</code> is an alternative to <a
9+
href="http://docs.angularjs.org/api/ng.directive:ngInclude">ngInclude</a>
10+
that adds fragment support via a <code>fragment</code> attribute. The
11+
fragment attribute uses the <a
12+
href="http://docs.angularjs.org/api/angular.element">element.find()</a>
13+
API, and therefore requires jQuery in order to support full CSS
14+
selectors; Without jQuery, it falls back to Angular's jqLite
15+
implementation which is very limited as it only selects by element
16+
name.</p>
17+
</div>
18+
<div class="span6">
19+
<h3>Why?</h3>
20+
<p>Use this instead of <code>ngInclude</code> only if you need
21+
fragments. Fragment support has two primary uses: (1) it serves as a
22+
drop in replacement for <a
23+
href="http://api.jquery.com/load/">jQuery.load()</a>, which permits a
24+
subset of a requested document to be selected, and (2) because some
25+
people want to put multiple templates into a single file and they need a
26+
way to select which specific fragment to use. The former use is
27+
expected to be benefit projects that are migrating from jQuery to
28+
Angular.</p>
29+
</div>
30+
</div>
31+
<div class="row">
32+
<div class="span12">
33+
<h3>Demo</h3>
34+
<div style="display: none">
35+
<fragment-1>Fragment 1</fragment-1>
36+
<fragment-2>Fragment 2</fragment-2>
37+
<fragment-3>Fragment 3</fragment-3>
38+
</div>
39+
Choose fragment to load:
40+
<select ng-model="uiIncludeFragment">
41+
<option value="fragment-1">fragment-1</option>
42+
<option value="fragment-2">fragment-2</option>
43+
<option value="fragment-3">fragment-3</option>
44+
</select>
45+
<br/>
46+
Fragment content <span ng-show="uiIncludeFragment">(<code>fragment="'{{uiIncludeFragment}}'"</code>)</span>:
47+
<div class="well">
48+
<ui-include src="'demos.html'" fragment="uiIncludeFragment" ng-show="uiIncludeFragment"></ui-include>
49+
</div>
50+
</div>
51+
</div>
52+
<div class="row">
53+
<div class="span12">
54+
<h3>How?</h3>
55+
<pre class="prettyprint">
56+
&lt;ui-include src="'my/url/to/partial/file'" fragment="'#id-to-fragment'"&gt;&lt;/ui-include&gt;
57+
&lt;!-- Don't forget to quote string literals! --&gt;
58+
&lt;!-- Don't forget to include jQuery if you need full selector support! --&gt;
59+
</pre>
60+
</div>
61+
</div>
62+
</section>

modules/utils.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ angular.module('ui.utils', [
22
"ui.event",
33
"ui.format",
44
"ui.highlight",
5+
"ui.include",
56
"ui.indeterminate",
67
"ui.inflector",
78
"ui.jq",
@@ -13,4 +14,4 @@ angular.module('ui.utils', [
1314
"ui.showhide",
1415
"ui.unique",
1516
"ui.validate"
16-
]);
17+
]);

0 commit comments

Comments
 (0)