Upgrade to angularjs 1.2.0 rc1
This commit is contained in:
parent
d223dfd662
commit
d6b021bfaf
674 changed files with 79667 additions and 62269 deletions
133
lib/angular/docs/partials/api/ng.directive:ngInclude.html
Normal file → Executable file
133
lib/angular/docs/partials/api/ng.directive:ngInclude.html
Normal file → Executable file
|
@ -1,18 +1,24 @@
|
|||
<h1><code ng:non-bindable="">ngInclude</code>
|
||||
<span class="hint">(directive in module <code ng:non-bindable="">ng</code>
|
||||
)</span>
|
||||
<a href="http://github.com/angular/angular.js/tree/v1.2.0rc1/src/ng/directive/ngInclude.js#L3" class="view-source btn btn-action"><i class="icon-zoom-in"> </i> View source</a><a href="http://github.com/angular/angular.js/edit/master/src/ng/directive/ngInclude.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">ngInclude</code>
|
||||
<div><span class="hint">directive in module <code ng:non-bindable="">ng</code>
|
||||
</span>
|
||||
</div>
|
||||
</h1>
|
||||
<div><a href="http://github.com/angular/angular.js/edit/master/src/ng/directive/ngInclude.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
|
||||
<div class="description"><p>Fetches, compiles and includes an external HTML fragment.</p>
|
||||
|
||||
<p>Keep in mind that Same Origin Policy applies to included resources
|
||||
(e.g. ngInclude won't work for cross-domain requests on all browsers and for
|
||||
file:// access on some browsers).</p>
|
||||
|
||||
<p>Additionally, you can also provide animations via the ngAnimate attribute to animate the <strong>enter</strong>
|
||||
and <strong>leave</strong> effects.</p></div>
|
||||
<div><h2 id="Description">Description</h2>
|
||||
<div class="description"><div class="ng-directive-page ng-directive-nginclude-page"><p>Fetches, compiles and includes an external HTML fragment.</p>
|
||||
<p>Keep in mind that:</p>
|
||||
<ul>
|
||||
<li>by default, the template URL is restricted to the same domain and protocol as the
|
||||
application document. This is done by calling <a href="api/ng.$sce#getTrustedResourceUrl"><code>$sce.getTrustedResourceUrl</code></a> on it. To load templates from other domains and/or protocols,
|
||||
you may either either <a href="api/ng.$sceDelegateProvider#resourceUrlWhitelist"><code>whitelist them</code></a> or
|
||||
<a href="api/ng.$sce#trustAsResourceUrl"><code>wrap it</code></a> into a trusted value. Refer Angular's <a href="api/ng.$sce"><code>Strict Contextual Escaping</code></a>.</li>
|
||||
<li>in addition, the browser's
|
||||
<a href="https://code.google.com/p/browsersec/wiki/Part2#Same-origin_policy_for_XMLHttpRequest">Same Origin Policy</a> and <a href="http://www.w3.org/TR/cors/">Cross-Origin Resource Sharing (CORS)</a> policy apply that may further restrict whether the template is successfully loaded.
|
||||
(e.g. ngInclude won't work for cross-domain requests on all browsers and for <code>file://</code>
|
||||
access on some browsers)</li>
|
||||
</ul>
|
||||
</div></div>
|
||||
<h2 id="Usage">Usage</h2>
|
||||
<div class="usage"><p>This directive can be used as custom element, but we aware of <a href="guide/ie">IE restrictions</a>.</p>as element:<pre class="prettyprint linenums"><ng-include
|
||||
<div class="usage"><p>This directive can be used as custom element, but be aware of <a href="guide/ie">IE restrictions</a>.</p>as element:<pre class="prettyprint linenums"><ng-include
|
||||
src="{string}"
|
||||
[onload="{string}"]
|
||||
[autoscroll="{string}"]>
|
||||
|
@ -25,37 +31,26 @@ as attribute<pre class="prettyprint linenums"><ANY ng-include="{string}"
|
|||
as class<pre class="prettyprint linenums"><ANY class="ng-include: {string}; [onload: {string};] [autoscroll: {string};]">
|
||||
...
|
||||
</ANY></pre>
|
||||
with <span id="animations">animations</span><pre class="prettyprint linenums">//The enter and leave animations are supported
|
||||
<ANY ng-include="{string}"
|
||||
[onload="{string}"]
|
||||
[autoscroll="{string}"] ng-animate="{enter: 'enter-animation', leave: 'leave-animation'}">
|
||||
...
|
||||
</ANY></pre>
|
||||
<a href="api/ng.$animator#Methods">Click here</a> to learn more about the steps involved in the animation.<h3 id="Directive.info">Directive info</h3>
|
||||
<h3 id="Directive.info">Directive info</h3>
|
||||
<div class="directive-info"><ul><li>This directive creates new scope.</li>
|
||||
</ul>
|
||||
</div>
|
||||
<h3 id="Parameters">Parameters</h3>
|
||||
<ul class="parameters"><li><code ng:non-bindable="">ngInclude|src – {string} – </code>
|
||||
<p>angular expression evaluating to URL. If the source is a string constant,
|
||||
make sure you wrap it in quotes, e.g. <code>src="'myPartialTemplate.html'"</code>.</p></li>
|
||||
<li><code ng:non-bindable="">onload<i>(optional)</i> – {string=} – </code>
|
||||
<p>Expression to evaluate when a new partial is loaded.</p></li>
|
||||
<li><code ng:non-bindable="">autoscroll<i>(optional)</i> – {string=} – </code>
|
||||
<p>Whether <code>ngInclude</code> should call <a href="api/ng.$anchorScroll"><code>$anchorScroll</code></a> to scroll the viewport after the content is loaded.</p>
|
||||
|
||||
<h3 id="Animations">Animations</h3>
|
||||
<div class="animations"><ul><li>enter - animation is used to bring new content into the browser.</li><li>leave - animation is used to animate existing content away.</li><li></li><li>The enter and leave animation occur concurrently.</li></ul></div>
|
||||
<a href="api/ngAnimate.$animate">Click here</a> to learn more about the steps involved in the animation.<h4 id="parameters">Parameters</h4><table class="variables-matrix table table-bordered table-striped"><thead><tr><th>Param</th><th>Type</th><th>Details</th></tr></thead><tbody><tr><td>ngInclude|src</td><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="ng-directive-page ng-directive-nginclude-page"><p>angular expression evaluating to URL. If the source is a string constant,
|
||||
make sure you wrap it in quotes, e.g. <code>src="'myPartialTemplate.html'"</code>.</p>
|
||||
</div></td></tr><tr><td>onload <div><em>(optional)</em></div></td><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="ng-directive-page ng-directive-nginclude-page"><p>Expression to evaluate when a new partial is loaded.</p>
|
||||
</div></td></tr><tr><td>autoscroll <div><em>(optional)</em></div></td><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="ng-directive-page ng-directive-nginclude-page"><p>Whether <code>ngInclude</code> should call <a href="api/ng.$anchorScroll"><code>$anchorScroll</code></a> to scroll the viewport after the content is loaded.</p>
|
||||
<ul>
|
||||
<li>If the attribute is not set, disable scrolling.</li>
|
||||
<li>If the attribute is set without value, enable scrolling.</li>
|
||||
<li>Otherwise enable scrolling only if the expression evaluates to truthy value.</li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
<h3 id="Animations">Animations</h3>
|
||||
<div class="animations"><ul><li>enter - happens just after the ngInclude contents change and a new DOM element is created and injected into the ngInclude container</li><li>leave - happens just after the ngInclude contents change and just before the former contents are removed from the DOM</li></ul></div>
|
||||
</div>
|
||||
</div></td></tr></tbody></table></div>
|
||||
<div class="member event"><h2 id="Events">Events</h2>
|
||||
<ul class="events"><li><h3 id="$includeContentLoaded">$includeContentLoaded</h3>
|
||||
<div class="$includecontentloaded"><p>Emitted every time the ngInclude content is reloaded.</p><div class="inline"><h4 id="Type.">Type:</h4>
|
||||
<div class="$includecontentloaded"><div class="ng-directive-page ng-directive-nginclude-includecontentloaded-page"><p>Emitted every time the ngInclude content is reloaded.</p>
|
||||
</div><div class="inline"><h4 id="Type.">Type:</h4>
|
||||
<div class="type-">emit</div>
|
||||
</div>
|
||||
<div class="inline"><h4 id="Target.">Target:</h4>
|
||||
|
@ -63,46 +58,66 @@ make sure you wrap it in quotes, e.g. <code>src="'myPartialTemplate.html'"</code
|
|||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li><h3 id="$includeContentRequested">$includeContentRequested</h3>
|
||||
<div class="$includecontentrequested"><div class="ng-directive-page ng-directive-nginclude-includecontentrequested-page"><p>Emitted every time the ngInclude content is requested.</p>
|
||||
</div><div class="inline"><h4 id="Type.">Type:</h4>
|
||||
<div class="type-">emit</div>
|
||||
</div>
|
||||
<div class="inline"><h4 id="Target.">Target:</h4>
|
||||
<div class="target-">the scope ngInclude was declared in</div>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<h2 id="Example">Example</h2>
|
||||
<div class="example"><h4>Source</h4>
|
||||
<div source-edit="" source-edit-deps="angular.js script.js" source-edit-html="index.html-159 template1.html template2.html" source-edit-css="animations.css" source-edit-js="script.js-160" source-edit-unit="" source-edit-scenario="scenario.js-161"></div>
|
||||
<div class="example"><div class="ng-directive-page ng-directive-nginclude-page"><h4>Source</h2>
|
||||
<div source-edit="" source-edit-deps="angular.js angular-animate.js script.js" source-edit-html="index.html-78 template1.html template2.html" source-edit-css="animations.css" source-edit-js="script.js-79" source-edit-json="" source-edit-unit="" source-edit-scenario="scenario.js-80"></div>
|
||||
<div class="tabbable"><div class="tab-pane" title="index.html">
|
||||
<pre class="prettyprint linenums" ng-set-text="index.html-159" ng-html-wrap=" angular.js script.js"></pre>
|
||||
<script type="text/ng-template" id="index.html-159">
|
||||
<pre class="prettyprint linenums" ng-set-text="index.html-78" ng-html-wrap=" angular.js angular-animate.js script.js"></pre>
|
||||
<script type="text/ng-template" id="index.html-78">
|
||||
<div ng-controller="Ctrl">
|
||||
<select ng-model="template" ng-options="t.name for t in templates">
|
||||
<option value="">(blank)</option>
|
||||
</select>
|
||||
url of the template: <tt>{{template.url}}</tt>
|
||||
<hr/>
|
||||
<div class="example-animate-container"
|
||||
ng-include="template.url"
|
||||
ng-animate="{enter: 'example-enter', leave: 'example-leave'}"></div>
|
||||
<div class="example-animate-container">
|
||||
<div class="include-example" ng-include="template.url"></div>
|
||||
</div>
|
||||
</div>
|
||||
</script>
|
||||
</div>
|
||||
<div class="tab-pane" title="template1.html">
|
||||
<pre class="prettyprint linenums" ng-set-text="template1.html"></pre>
|
||||
<script type="text/ng-template" id="template1.html">
|
||||
<div>Content of template1.html</div>
|
||||
Content of template1.html
|
||||
</script>
|
||||
</div>
|
||||
<div class="tab-pane" title="template2.html">
|
||||
<pre class="prettyprint linenums" ng-set-text="template2.html"></pre>
|
||||
<script type="text/ng-template" id="template2.html">
|
||||
<div>Content of template2.html</div>
|
||||
Content of template2.html
|
||||
</script>
|
||||
</div>
|
||||
<div class="tab-pane" title="animations.css">
|
||||
<pre class="prettyprint linenums" ng-set-text="animations.css"></pre>
|
||||
<style type="text/css" id="animations.css">
|
||||
.example-leave-setup,
|
||||
.example-enter-setup {
|
||||
.example-animate-container {
|
||||
position:relative;
|
||||
background:white;
|
||||
border:1px solid black;
|
||||
height:40px;
|
||||
overflow:hidden;
|
||||
}
|
||||
|
||||
.example-animate-container > div {
|
||||
padding:10px;
|
||||
}
|
||||
|
||||
.include-example.ng-enter, .include-example.ng-leave {
|
||||
-webkit-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;
|
||||
-moz-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;
|
||||
-ms-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;
|
||||
-o-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;
|
||||
transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) 0.5s;
|
||||
|
||||
|
@ -111,31 +126,28 @@ make sure you wrap it in quotes, e.g. <code>src="'myPartialTemplate.html'"</code
|
|||
left:0;
|
||||
right:0;
|
||||
bottom:0;
|
||||
}
|
||||
|
||||
.example-animate-container > * {
|
||||
display:block;
|
||||
padding:10px;
|
||||
}
|
||||
|
||||
.example-enter-setup {
|
||||
.include-example.ng-enter {
|
||||
top:-50px;
|
||||
}
|
||||
.example-enter-setup.example-enter-start {
|
||||
.include-example.ng-enter.ng-enter-active {
|
||||
top:0;
|
||||
}
|
||||
|
||||
.example-leave-setup {
|
||||
.include-example.ng-leave {
|
||||
top:0;
|
||||
}
|
||||
.example-leave-setup.example-leave-start {
|
||||
.include-example.ng-leave.ng-leave-active {
|
||||
top:50px;
|
||||
}
|
||||
</style>
|
||||
</div>
|
||||
<div class="tab-pane" title="script.js">
|
||||
<pre class="prettyprint linenums" ng-set-text="script.js-160"></pre>
|
||||
<script type="text/ng-template" id="script.js-160">
|
||||
<pre class="prettyprint linenums" ng-set-text="script.js-79"></pre>
|
||||
<script type="text/ng-template" id="script.js-79">
|
||||
function Ctrl($scope) {
|
||||
$scope.templates =
|
||||
[ { name: 'template1.html', url: 'template1.html'}
|
||||
|
@ -145,8 +157,8 @@ make sure you wrap it in quotes, e.g. <code>src="'myPartialTemplate.html'"</code
|
|||
</script>
|
||||
</div>
|
||||
<div class="tab-pane" title="End to end test">
|
||||
<pre class="prettyprint linenums" ng-set-text="scenario.js-161"></pre>
|
||||
<script type="text/ng-template" id="scenario.js-161">
|
||||
<pre class="prettyprint linenums" ng-set-text="scenario.js-80"></pre>
|
||||
<script type="text/ng-template" id="scenario.js-80">
|
||||
it('should load template1.html', function() {
|
||||
expect(element('.doc-example-live [ng-include]').text()).
|
||||
toMatch(/Content of template1.html/);
|
||||
|
@ -158,10 +170,11 @@ make sure you wrap it in quotes, e.g. <code>src="'myPartialTemplate.html'"</code
|
|||
});
|
||||
it('should change to blank', function() {
|
||||
select('template').option('');
|
||||
expect(element('.doc-example-live [ng-include]').text()).toEqual('');
|
||||
expect(element('.doc-example-live [ng-include]')).toBe(undefined);
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
</div><h4>Demo</h4>
|
||||
<div class="well doc-example-live animator-container" ng-embed-app="" ng-set-html="index.html-159" ng-eval-javascript="script.js-160"></div></div>
|
||||
</div><div class="pull-right"> <button class="btn btn-primary" ng-click="animationsOff=true" ng-hide="animationsOff">Animations on</button> <button class="btn btn-primary disabled" ng-click="animationsOff=false" ng-show="animationsOff">Animations off</button></div><h2>Demo</h4>
|
||||
<div class="well doc-example-live animate-container" ng-class="{'animations-off':animationsOff == true}" ng-embed-app="" ng-set-html="index.html-78" ng-eval-javascript="script.js-79"></div>
|
||||
</div></div>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue