Upgrade to angularjs 1.2.0 rc1

This commit is contained in:
Colin Frei 2013-08-21 19:46:51 +02:00
parent d223dfd662
commit d6b021bfaf
674 changed files with 79667 additions and 62269 deletions

126
lib/angular/docs/partials/api/AUTO.$injector.html Normal file → Executable file
View file

@ -1,14 +1,13 @@
<h1><code ng:non-bindable="">$injector</code>
<span class="hint">(service in module <code ng:non-bindable="">AUTO</code>
)</span>
<a href="http://github.com/angular/angular.js/tree/v1.2.0rc1/src/auto/injector.js#L76" 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/auto/injector.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">$injector</code>
<div><span class="hint">service in module <code ng:non-bindable="">AUTO</code>
</span>
</div>
</h1>
<div><a href="http://github.com/angular/angular.js/edit/master/src/auto/injector.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p><code>$injector</code> is used to retrieve object instances as defined by
<div><h2 id="Description">Description</h2>
<div class="description"><div class="auto-injector-page"><p><code>$injector</code> is used to retrieve object instances as defined by
<a href="api/AUTO.$provide"><code>provider</code></a>, instantiate types, invoke methods,
and load modules.</p>
<p>The following always holds true:</p>
<pre class="prettyprint linenums">
var $injector = angular.injector();
expect($injector.get('$injector')).toBe($injector);
@ -16,12 +15,9 @@ and load modules.</p>
return $injector;
}).toBe($injector);
</pre>
<h3>Injection Function Annotation</h3>
<p>JavaScript does not have annotations, and annotations are needed for dependency injection. The
following ways are all valid way of annotating function with injection arguments and are equivalent.</p>
following are all valid ways of annotating function with injection arguments and are equivalent.</p>
<pre class="prettyprint linenums">
// inferred (only works if code not minified/obfuscated)
$injector.invoke(function(serviceA){});
@ -34,28 +30,21 @@ following ways are all valid way of annotating function with injection arguments
// inline
$injector.invoke(['serviceA', function(serviceA){}]);
</pre>
<h4>Inference</h4>
<h4>Inference</h2>
<p>In JavaScript calling <code>toString()</code> on a function returns the function definition. The definition can then be
parsed and the function arguments can be extracted. <em>NOTE:</em> This does not work with minification, and obfuscation
tools since these tools change the argument names.</p>
<h4><code>$inject</code> Annotation</h4>
<h2><code>$inject</code> Annotation</h2>
<p>By adding a <code>$inject</code> property onto a function the injection parameters can be specified.</p>
<h4>Inline</h4>
<p>As an array of injection names, where the last item in the array is the function to call.</p></div>
<h2>Inline</h4>
<p>As an array of injection names, where the last item in the array is the function to call.</p>
</div></div>
<div class="member method"><h2 id="Methods">Methods</h2>
<ul class="methods"><li><h3 id="annotate">annotate(fn)</h3>
<div class="annotate"><p>Returns an array of service names which the function is requesting for injection. This API is used by the injector
<div class="annotate"><div class="auto-injector-annotate-page"><p>Returns an array of service names which the function is requesting for injection. This API is used by the injector
to determine which services need to be injected into the function when the function is invoked. There are three
ways in which the function can be annotated with the needed dependencies.</p>
<h4>Argument names</h4>
<h4>Argument names</h1>
<p>The simplest form is to extract the dependencies from the arguments of the function. This is done by converting
the function into a string using <code>toString()</code> method and extracting the argument names.
<pre class="prettyprint linenums">
@ -67,12 +56,9 @@ the function into a string using <code>toString()</code> method and extracting t
// Then
expect(injector.annotate(MyController)).toEqual(['$scope', '$route']);
</pre>
<p>This method does not work with code minfication / obfuscation. For this reason the following annotation strategies
<p>This method does not work with code minification / obfuscation. For this reason the following annotation strategies
are supported.</p>
<h4>The <code>$inject</code> property</h4>
<h1>The <code>$inject</code> property</h1>
<p>If a function has an <code>$inject</code> property and its value is an array of strings, then the strings represent names of
services to be injected into the function.
<pre class="prettyprint linenums">
@ -86,13 +72,10 @@ services to be injected into the function.
// Then
expect(injector.annotate(MyController)).toEqual(['$scope', '$route']);
</pre>
<h4>The array notation</h4>
<p>It is often desirable to inline Injected functions and that's when setting the <code>$inject</code> property is very
<h1>The array notation</h4>
<p>It is often desirable to inline Injected functions and that&#39;s when setting the <code>$inject</code> property is very
inconvenient. In these situations using the array notation to specify the dependencies in a way that survives
minification is a better choice:</p>
<pre class="prettyprint linenums">
// We wish to write this (not minification / obfuscation safe)
injector.invoke(function($compile, $rootScope) {
@ -104,7 +87,7 @@ minification is a better choice:</p>
// ...
};
tmpFn.$inject = ['$compile', '$rootScope'];
injector.invoke(tempFn);
injector.invoke(tmpFn);
// To better support inline function the inline annotation is supported
injector.invoke(['$compile', '$rootScope', function(obfCompile, obfRootScope) {
@ -115,54 +98,41 @@ minification is a better choice:</p>
expect(injector.annotate(
['$compile', '$rootScope', function(obfus_$compile, obfus_$rootScope) {}])
).toEqual(['$compile', '$rootScope']);
</pre><h4 id="Parameters">Parameters</h4>
<ul class="parameters"><li><code ng:non-bindable="">fn {function|Array.&lt;string|Function&gt;} </code>
<p>Function for which dependent service names need to be retrieved as described
above.</p></li>
</ul>
<h4 id="Returns">Returns</h4>
<div class="returns"><code ng:non-bindable="">{Array.&lt;string&gt;}</code>
<p>The names of the services which the function requires.</p></div>
</div>
</pre>
</div><h5 id="parameters">Parameters</h5><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>fn</td><td><a href="" class="label type-hint type-hint-function">function</a><a href="" class="label type-hint type-hint-array">Array.&lt;string|Function&gt;</a></td><td><div class="auto-injector-annotate-page"><p>Function for which dependent service names need to be retrieved as described
above.</p>
</div></td></tr></tbody></table><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-array">Array.&lt;string&gt;</a></td><td><div class="auto-injector-annotate-page"><p>The names of the services which the function requires.</p>
</div></td></tr></table></div>
</li>
<li><h3 id="get">get(name)</h3>
<div class="get"><p>Return an instance of the service.</p><h4 id="Parameters">Parameters</h4>
<ul class="parameters"><li><code ng:non-bindable="">name {string} </code>
<p>The name of the instance to retrieve.</p></li>
</ul>
<h4 id="Returns">Returns</h4>
<div class="returns"><code ng:non-bindable="">{*}</code>
<p>The instance.</p></div>
</div>
<div class="get"><div class="auto-injector-get-page"><p>Return an instance of the service.</p>
</div><h5 id="parameters">Parameters</h5><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>name</td><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="auto-injector-get-page"><p>The name of the instance to retrieve.</p>
</div></td></tr></tbody></table><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-object">*</a></td><td><div class="auto-injector-get-page"><p>The instance.</p>
</div></td></tr></table></div>
</li>
<li><h3 id="has">has(Name)</h3>
<div class="has"><div class="auto-injector-has-page"><p>Allows the user to query if the particular service exist.</p>
</div><h5 id="parameters">Parameters</h5><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>Name</td><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="auto-injector-has-page"><p>of the service to query.</p>
</div></td></tr></tbody></table><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-boolean">boolean</a></td><td><div class="auto-injector-has-page"><p>returns true if injector has given service.</p>
</div></td></tr></table></div>
</li>
<li><h3 id="instantiate">instantiate(Type, locals)</h3>
<div class="instantiate"><p>Create a new instance of JS type. The method takes a constructor function invokes the new operator and supplies
all of the arguments to the constructor function as specified by the constructor annotation.</p><h4 id="Parameters">Parameters</h4>
<ul class="parameters"><li><code ng:non-bindable="">Type {function} </code>
<p>Annotated constructor function.</p></li>
<li><code ng:non-bindable="">locals<i>(optional)</i> {Object=} </code>
<p>Optional object. If preset then any argument names are read from this object first, before
the <code>$injector</code> is consulted.</p></li>
</ul>
<h4 id="Returns">Returns</h4>
<div class="returns"><code ng:non-bindable="">{Object}</code>
<p>new instance of <code>Type</code>.</p></div>
</div>
<div class="instantiate"><div class="auto-injector-instantiate-page"><p>Create a new instance of JS type. The method takes a constructor function invokes the new operator and supplies
all of the arguments to the constructor function as specified by the constructor annotation.</p>
</div><h5 id="parameters">Parameters</h5><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>Type</td><td><a href="" class="label type-hint type-hint-function">function</a></td><td><div class="auto-injector-instantiate-page"><p>Annotated constructor function.</p>
</div></td></tr><tr><td>locals <div><em>(optional)</em></div></td><td><a href="" class="label type-hint type-hint-object">Object</a></td><td><div class="auto-injector-instantiate-page"><p>Optional object. If preset then any argument names are read from this object first, before
the <code>$injector</code> is consulted.</p>
</div></td></tr></tbody></table><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-object">Object</a></td><td><div class="auto-injector-instantiate-page"><p>new instance of <code>Type</code>.</p>
</div></td></tr></table></div>
</li>
<li><h3 id="invoke">invoke(fn, self, locals)</h3>
<div class="invoke"><p>Invoke the method and supply the method arguments from the <code>$injector</code>.</p><h4 id="Parameters">Parameters</h4>
<ul class="parameters"><li><code ng:non-bindable="">fn {!function} </code>
<p>The function to invoke. The function arguments come form the function annotation.</p></li>
<li><code ng:non-bindable="">self<i>(optional)</i> {Object=} </code>
<p>The <code>this</code> for the invoked method.</p></li>
<li><code ng:non-bindable="">locals<i>(optional)</i> {Object=} </code>
<p>Optional object. If preset then any argument names are read from this object first, before
the <code>$injector</code> is consulted.</p></li>
</ul>
<h4 id="Returns">Returns</h4>
<div class="returns"><code ng:non-bindable="">{*}</code>
<p>the value returned by the invoked <code>fn</code> function.</p></div>
</div>
<div class="invoke"><div class="auto-injector-invoke-page"><p>Invoke the method and supply the method arguments from the <code>$injector</code>.</p>
</div><h5 id="parameters">Parameters</h5><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>fn</td><td><a href="" class="label type-hint type-hint-object">!function</a></td><td><div class="auto-injector-invoke-page"><p>The function to invoke. The function arguments come form the function annotation.</p>
</div></td></tr><tr><td>self <div><em>(optional)</em></div></td><td><a href="" class="label type-hint type-hint-object">Object</a></td><td><div class="auto-injector-invoke-page"><p>The <code>this</code> for the invoked method.</p>
</div></td></tr><tr><td>locals <div><em>(optional)</em></div></td><td><a href="" class="label type-hint type-hint-object">Object</a></td><td><div class="auto-injector-invoke-page"><p>Optional object. If preset then any argument names are read from this object first, before
the <code>$injector</code> is consulted.</p>
</div></td></tr></tbody></table><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-object">*</a></td><td><div class="auto-injector-invoke-page"><p>the value returned by the invoked <code>fn</code> function.</p>
</div></td></tr></table></div>
</li>
</ul>
</div>

126
lib/angular/docs/partials/api/AUTO.$provide.html Normal file → Executable file
View file

@ -1,14 +1,13 @@
<h1><code ng:non-bindable="">$provide</code>
<span class="hint">(service in module <code ng:non-bindable="">AUTO</code>
)</span>
<a href="http://github.com/angular/angular.js/tree/v1.2.0rc1/src/auto/injector.js#L263" 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/auto/injector.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">$provide</code>
<div><span class="hint">service in module <code ng:non-bindable="">AUTO</code>
</span>
</div>
</h1>
<div><a href="http://github.com/angular/angular.js/edit/master/src/auto/injector.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p>Use <code>$provide</code> to register new providers with the <code>$injector</code>. The providers are the factories for the instance.
<div><h2 id="Description">Description</h2>
<div class="description"><div class="auto-provide-page"><p>Use <code>$provide</code> to register new providers with the <code>$injector</code>. The providers are the factories for the instance.
The providers share the same name as the instance they create with <code>Provider</code> suffixed to them.</p>
<p>A provider is an object with a <code>$get()</code> method. The injector calls the <code>$get</code> method to create a new instance of
a service. The Provider can have additional methods which would allow for configuration of the provider.</p>
<pre class="prettyprint linenums">
function GreetProvider() {
var salutation = 'Hello';
@ -28,7 +27,7 @@ a service. The Provider can have additional methods which would allow for config
beforeEach(module(function($provide) {
$provide.provider('greet', GreetProvider);
});
}));
it('should greet', inject(function(greet) {
expect(greet('angular')).toEqual('Hello angular!');
@ -41,97 +40,66 @@ a service. The Provider can have additional methods which would allow for config
inject(function(greet) {
expect(greet('angular')).toEqual('Ahoj angular!');
});
)};
});
</pre></div>
});
</pre>
</div></div>
<div class="member method"><h2 id="Methods">Methods</h2>
<ul class="methods"><li><h3 id="constant">constant(name, value)</h3>
<div class="constant"><p>A constant value, but unlike <a href="api/AUTO.$provide#value"><code>value</code></a> it can be injected
<div class="constant"><div class="auto-provide-constant-page"><p>A constant value, but unlike <a href="api/AUTO.$provide#value"><code>value</code></a> it can be injected
into configuration function (other modules) and it is not interceptable by
<a href="api/AUTO.$provide#decorator"><code>decorator</code></a>.</p><h4 id="Parameters">Parameters</h4>
<ul class="parameters"><li><code ng:non-bindable="">name {string} </code>
<p>The name of the constant.</p></li>
<li><code ng:non-bindable="">value {*} </code>
<p>The constant value.</p></li>
</ul>
<h4 id="Returns">Returns</h4>
<div class="returns"><code ng:non-bindable="">{Object}</code>
<p>registered instance</p></div>
</div>
<a href="api/AUTO.$provide#decorator"><code>decorator</code></a>.</p>
</div><h5 id="parameters">Parameters</h5><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>name</td><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="auto-provide-constant-page"><p>The name of the constant.</p>
</div></td></tr><tr><td>value</td><td><a href="" class="label type-hint type-hint-object">*</a></td><td><div class="auto-provide-constant-page"><p>The constant value.</p>
</div></td></tr></tbody></table><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-object">Object</a></td><td><div class="auto-provide-constant-page"><p>registered instance</p>
</div></td></tr></table></div>
</li>
<li><h3 id="decorator">decorator(name, decorator)</h3>
<div class="decorator"><p>Decoration of service, allows the decorator to intercept the service instance creation. The
<div class="decorator"><div class="auto-provide-decorator-page"><p>Decoration of service, allows the decorator to intercept the service instance creation. The
returned instance may be the original instance, or a new instance which delegates to the
original instance.</p><h4 id="Parameters">Parameters</h4>
<ul class="parameters"><li><code ng:non-bindable="">name {string} </code>
<p>The name of the service to decorate.</p></li>
<li><code ng:non-bindable="">decorator {function()} </code>
<p>This function will be invoked when the service needs to be
instanciated. The function is called using the <a href="api/AUTO.$injector#invoke"><code>injector.invoke</code></a> method and is therefore fully injectable. Local injection arguments:</p>
original instance.</p>
</div><h5 id="parameters">Parameters</h5><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>name</td><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="auto-provide-decorator-page"><p>The name of the service to decorate.</p>
</div></td></tr><tr><td>decorator</td><td><a href="" class="label type-hint type-hint-function">function()</a></td><td><div class="auto-provide-decorator-page"><p>This function will be invoked when the service needs to be
instantiated. The function is called using the <a href="api/AUTO.$injector#invoke"><code>injector.invoke</code></a> method and is therefore fully injectable. Local injection arguments:</p>
<ul>
<li><code>$delegate</code> - The original service instance, which can be monkey patched, configured,
decorated or delegated to.</li>
</ul></li>
</ul>
</div>
</div></td></tr></tbody></table></div>
</li>
<li><h3 id="factory">factory(name, $getFn)</h3>
<div class="factory"><p>A short hand for configuring services if only <code>$get</code> method is required.</p><h4 id="Parameters">Parameters</h4>
<ul class="parameters"><li><code ng:non-bindable="">name {string} </code>
<p>The name of the instance.</p></li>
<li><code ng:non-bindable="">$getFn {function()} </code>
<p>The $getFn for the instance creation. Internally this is a short hand for
<code>$provide.provider(name, {$get: $getFn})</code>.</p></li>
</ul>
<h4 id="Returns">Returns</h4>
<div class="returns"><code ng:non-bindable="">{Object}</code>
<p>registered provider instance</p></div>
</div>
<div class="factory"><div class="auto-provide-factory-page"><p>A short hand for configuring services if only <code>$get</code> method is required.</p>
</div><h5 id="parameters">Parameters</h5><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>name</td><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="auto-provide-factory-page"><p>The name of the instance.</p>
</div></td></tr><tr><td>$getFn</td><td><a href="" class="label type-hint type-hint-function">function()</a></td><td><div class="auto-provide-factory-page"><p>The $getFn for the instance creation. Internally this is a short hand for
<code>$provide.provider(name, {$get: $getFn})</code>.</p>
</div></td></tr></tbody></table><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-object">Object</a></td><td><div class="auto-provide-factory-page"><p>registered provider instance</p>
</div></td></tr></table></div>
</li>
<li><h3 id="provider">provider(name, provider)</h3>
<div class="provider"><p>Register a provider for a service. The providers can be retrieved and can have additional configuration methods.</p><h4 id="Parameters">Parameters</h4>
<ul class="parameters"><li><code ng:non-bindable="">name {string} </code>
<p>The name of the instance. NOTE: the provider will be available under <code>name + 'Provider'</code> key.</p></li>
<li><code ng:non-bindable="">provider {(Object|function())} </code>
<p>If the provider is:</p>
<div class="provider"><div class="auto-provide-provider-page"><p>Register a provider for a service. The providers can be retrieved and can have additional configuration methods.</p>
</div><h5 id="parameters">Parameters</h5><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>name</td><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="auto-provide-provider-page"><p>The name of the instance. NOTE: the provider will be available under <code>name + &#39;Provider&#39;</code> key.</p>
</div></td></tr><tr><td>provider</td><td><a href="" class="label type-hint type-hint-object">Object</a><a href="" class="label type-hint type-hint-function">function()</a></td><td><div class="auto-provide-provider-page"><p>If the provider is:</p>
<ul>
<li><code>Object</code>: then it should have a <code>$get</code> method. The <code>$get</code> method will be invoked using
<a href="api/AUTO.$injector#invoke"><code>$injector.invoke()</code></a> when an instance needs to be created.</li>
<li><code>Constructor</code>: a new instance of the provider will be created using
<a href="api/AUTO.$injector#instantiate"><code>$injector.instantiate()</code></a>, then treated as <code>object</code>.</li>
</ul></li>
<li><code>Object</code>: then it should have a <code>$get</code> method. The <code>$get</code> method will be invoked using<pre><code> &lt;a href=&quot;api/AUTO.$injector#invoke&quot;&gt;&lt;code&gt;$injector.invoke()&lt;/code&gt;&lt;/a&gt; when an instance needs to be created.</code></pre>
</li>
<li><code>Constructor</code>: a new instance of the provider will be created using<pre><code> &lt;a href=&quot;api/AUTO.$injector#instantiate&quot;&gt;&lt;code&gt;$injector.instantiate()&lt;/code&gt;&lt;/a&gt;, then treated as `object`.</code></pre>
</li>
</ul>
<h4 id="Returns">Returns</h4>
<div class="returns"><code ng:non-bindable="">{Object}</code>
<p>registered provider instance</p></div>
</div>
</div></td></tr></tbody></table><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-object">Object</a></td><td><div class="auto-provide-provider-page"><p>registered provider instance</p>
</div></td></tr></table></div>
</li>
<li><h3 id="service">service(name, constructor)</h3>
<div class="service"><p>A short hand for registering service of given class.</p><h4 id="Parameters">Parameters</h4>
<ul class="parameters"><li><code ng:non-bindable="">name {string} </code>
<p>The name of the instance.</p></li>
<li><code ng:non-bindable="">constructor {Function} </code>
<p>A class (constructor function) that will be instantiated.</p></li>
</ul>
<h4 id="Returns">Returns</h4>
<div class="returns"><code ng:non-bindable="">{Object}</code>
<p>registered provider instance</p></div>
</div>
<div class="service"><div class="auto-provide-service-page"><p>A short hand for registering service of given class.</p>
</div><h5 id="parameters">Parameters</h5><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>name</td><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="auto-provide-service-page"><p>The name of the instance.</p>
</div></td></tr><tr><td>constructor</td><td><a href="" class="label type-hint type-hint-function">Function</a></td><td><div class="auto-provide-service-page"><p>A class (constructor function) that will be instantiated.</p>
</div></td></tr></tbody></table><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-object">Object</a></td><td><div class="auto-provide-service-page"><p>registered provider instance</p>
</div></td></tr></table></div>
</li>
<li><h3 id="value">value(name, value)</h3>
<div class="value"><p>A short hand for configuring services if the <code>$get</code> method is a constant.</p><h4 id="Parameters">Parameters</h4>
<ul class="parameters"><li><code ng:non-bindable="">name {string} </code>
<p>The name of the instance.</p></li>
<li><code ng:non-bindable="">value {*} </code>
<p>The value.</p></li>
</ul>
<h4 id="Returns">Returns</h4>
<div class="returns"><code ng:non-bindable="">{Object}</code>
<p>registered provider instance</p></div>
</div>
<div class="value"><div class="auto-provide-value-page"><p>A short hand for configuring services if the <code>$get</code> method is a constant.</p>
</div><h5 id="parameters">Parameters</h5><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>name</td><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="auto-provide-value-page"><p>The name of the instance.</p>
</div></td></tr><tr><td>value</td><td><a href="" class="label type-hint type-hint-object">*</a></td><td><div class="auto-provide-value-page"><p>The value.</p>
</div></td></tr></tbody></table><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-object">Object</a></td><td><div class="auto-provide-value-page"><p>registered provider instance</p>
</div></td></tr></table></div>
</li>
</ul>
</div>

8
lib/angular/docs/partials/api/AUTO.html Normal file → Executable file
View file

@ -1,4 +1,6 @@
<h1><code ng:non-bindable=""></code>
<span class="hint"></span>
<a href="http://github.com/angular/angular.js/tree/v1.2.0rc1/src/auto/injector.js#L33" 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/auto/injector.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable=""></code>
<div><span class="hint"></span>
</div>
</h1>
<div><a href="http://github.com/angular/angular.js/edit/master/src/auto/injector.js" class="improve-docs btn btn-primary">Improve this doc</a><p>Implicit module which gets automatically added to each <a href="api/AUTO.$injector"><code>$injector</code></a>.</p></div>
<div><div class="auto-page"><p>Implicit module which gets automatically added to each <a href="../../../../../index.htmlinjector"><code>$injector</code></a>.</p>
</div></div>

172
lib/angular/docs/partials/api/angular.IModule.html Normal file → Executable file
View file

@ -1,139 +1,109 @@
<h1><code ng:non-bindable="">Module</code>
<span class="hint">(Type in module <code ng:non-bindable="">ng</code>
)</span>
<a href="http://github.com/angular/angular.js/tree/v1.2.0rc1/src/loader.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/loader.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">Module</code>
<div><span class="hint">Type in module <code ng:non-bindable="">ng</code>
</span>
</div>
</h1>
<div><a href="http://github.com/angular/angular.js/edit/master/src/loader.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p>Interface for configuring angular <a href="api/angular.module"><code>modules</code></a>.</p></div>
<div><h2 id="Description">Description</h2>
<div class="description"><div class="angular-module-page"><p>Interface for configuring angular <a href="api/angular.module"><code>modules</code></a>.</p>
</div></div>
<div class="member method"><h2 id="Methods">Methods</h2>
<ul class="methods"><li><h3 id="animation">animation(name, animationFactory)</h3>
<div class="animation"><p>Defines an animation hook that can be later used with <a href="api/ng.directive:ngAnimate"><code>ngAnimate</code></a>
alongside <a href="api/ng.directive:ngAnimate#Description"><code>common ng directives</code></a> as well as custom directives.
<div class="animation"><div class="angular-module-animation-page"><p><strong>NOTE</strong>: animations are take effect only if the <strong>ngAnimate</strong> module is loaded.</p>
<p>Defines an animation hook that can be later used with <a href="api/ngAnimate.$animate">$animate</a> service and
directives that use this service.</p>
<pre class="prettyprint linenums">
module.animation('animation-name', function($inject1, $inject2) {
module.animation('.animation-name', function($inject1, $inject2) {
return {
//this gets called in preparation to setup an animation
setup : function(element) { ... },
//this gets called once the animation is run
start : function(element, done, memo) { ... }
eventName : function(element, done) {
//code to run the animation
//once complete, then run done()
return function cancellationFunction(element) {
//code to cancel the animation
}
}
}
})
</pre>
<p>See <a href="api/ng.$animationProvider#register"><code>$animationProvider.register()</code></a> and
<a href="api/ng.directive:ngAnimate"><code>ngAnimate</code></a> for more information.</p><h4 id="Parameters">Parameters</h4>
<ul class="parameters"><li><code ng:non-bindable="">name {string} </code>
<p>animation name</p></li>
<li><code ng:non-bindable="">animationFactory {Function} </code>
<p>Factory function for creating new instance of an animation.</p></li>
</ul>
</div>
<p>See <a href="api/ngAnimate.$animateProvider#register">$animateProvider.register()</a> and
<a href="api/ngAnimate">ngAnimate module</a> for more information.</p>
</div><h5 id="parameters">Parameters</h5><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>name</td><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="angular-module-animation-page"><p>animation name</p>
</div></td></tr><tr><td>animationFactory</td><td><a href="" class="label type-hint type-hint-function">Function</a></td><td><div class="angular-module-animation-page"><p>Factory function for creating new instance of an animation.</p>
</div></td></tr></tbody></table></div>
</li>
<li><h3 id="config">config(configFn)</h3>
<div class="config"><p>Use this method to register work which needs to be performed on module loading.</p><h4 id="Parameters">Parameters</h4>
<ul class="parameters"><li><code ng:non-bindable="">configFn {Function} </code>
<p>Execute this function on module load. Useful for service
configuration.</p></li>
</ul>
</div>
<div class="config"><div class="angular-module-config-page"><p>Use this method to register work which needs to be performed on module loading.</p>
</div><h5 id="parameters">Parameters</h5><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>configFn</td><td><a href="" class="label type-hint type-hint-function">Function</a></td><td><div class="angular-module-config-page"><p>Execute this function on module load. Useful for service
configuration.</p>
</div></td></tr></tbody></table></div>
</li>
<li><h3 id="constant">constant(name, object)</h3>
<div class="constant"><p>Because the constant are fixed, they get applied before other provide methods.
See <a href="api/AUTO.$provide#constant"><code>$provide.constant()</code></a>.</p><h4 id="Parameters">Parameters</h4>
<ul class="parameters"><li><code ng:non-bindable="">name {string} </code>
<p>constant name</p></li>
<li><code ng:non-bindable="">object {*} </code>
<p>Constant value.</p></li>
</ul>
</div>
<div class="constant"><div class="angular-module-constant-page"><p>Because the constant are fixed, they get applied before other provide methods.
See <a href="api/AUTO.$provide#constant"><code>$provide.constant()</code></a>.</p>
</div><h5 id="parameters">Parameters</h5><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>name</td><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="angular-module-constant-page"><p>constant name</p>
</div></td></tr><tr><td>object</td><td><a href="" class="label type-hint type-hint-object">*</a></td><td><div class="angular-module-constant-page"><p>Constant value.</p>
</div></td></tr></tbody></table></div>
</li>
<li><h3 id="controller">controller(name, constructor)</h3>
<div class="controller"><p>See <a href="api/ng.$controllerProvider#register"><code>$controllerProvider.register()</code></a>.</p><h4 id="Parameters">Parameters</h4>
<ul class="parameters"><li><code ng:non-bindable="">name {string} </code>
<p>Controller name.</p></li>
<li><code ng:non-bindable="">constructor {Function} </code>
<p>Controller constructor function.</p></li>
</ul>
</div>
<div class="controller"><div class="angular-module-controller-page"><p>See <a href="api/ng.$controllerProvider#register"><code>$controllerProvider.register()</code></a>.</p>
</div><h5 id="parameters">Parameters</h5><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>name</td><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="angular-module-controller-page"><p>Controller name.</p>
</div></td></tr><tr><td>constructor</td><td><a href="" class="label type-hint type-hint-function">Function</a></td><td><div class="angular-module-controller-page"><p>Controller constructor function.</p>
</div></td></tr></tbody></table></div>
</li>
<li><h3 id="directive">directive(name, directiveFactory)</h3>
<div class="directive"><p>See <a href="api/ng.$compileProvider#directive"><code>$compileProvider.directive()</code></a>.</p><h4 id="Parameters">Parameters</h4>
<ul class="parameters"><li><code ng:non-bindable="">name {string} </code>
<p>directive name</p></li>
<li><code ng:non-bindable="">directiveFactory {Function} </code>
<p>Factory function for creating new instance of
directives.</p></li>
</ul>
</div>
<div class="directive"><div class="angular-module-directive-page"><p>See <a href="api/ng.$compileProvider#directive"><code>$compileProvider.directive()</code></a>.</p>
</div><h5 id="parameters">Parameters</h5><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>name</td><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="angular-module-directive-page"><p>directive name</p>
</div></td></tr><tr><td>directiveFactory</td><td><a href="" class="label type-hint type-hint-function">Function</a></td><td><div class="angular-module-directive-page"><p>Factory function for creating new instance of
directives.</p>
</div></td></tr></tbody></table></div>
</li>
<li><h3 id="factory">factory(name, providerFunction)</h3>
<div class="factory"><p>See <a href="api/AUTO.$provide#factory"><code>$provide.factory()</code></a>.</p><h4 id="Parameters">Parameters</h4>
<ul class="parameters"><li><code ng:non-bindable="">name {string} </code>
<p>service name</p></li>
<li><code ng:non-bindable="">providerFunction {Function} </code>
<p>Function for creating new instance of the service.</p></li>
</ul>
</div>
<div class="factory"><div class="angular-module-factory-page"><p>See <a href="api/AUTO.$provide#factory"><code>$provide.factory()</code></a>.</p>
</div><h5 id="parameters">Parameters</h5><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>name</td><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="angular-module-factory-page"><p>service name</p>
</div></td></tr><tr><td>providerFunction</td><td><a href="" class="label type-hint type-hint-function">Function</a></td><td><div class="angular-module-factory-page"><p>Function for creating new instance of the service.</p>
</div></td></tr></tbody></table></div>
</li>
<li><h3 id="filter">filter(name, filterFactory)</h3>
<div class="filter"><p>See <a href="api/ng.$filterProvider#register"><code>$filterProvider.register()</code></a>.</p><h4 id="Parameters">Parameters</h4>
<ul class="parameters"><li><code ng:non-bindable="">name {string} </code>
<p>Filter name.</p></li>
<li><code ng:non-bindable="">filterFactory {Function} </code>
<p>Factory function for creating new instance of filter.</p></li>
</ul>
</div>
<div class="filter"><div class="angular-module-filter-page"><p>See <a href="api/ng.$filterProvider#register"><code>$filterProvider.register()</code></a>.</p>
</div><h5 id="parameters">Parameters</h5><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>name</td><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="angular-module-filter-page"><p>Filter name.</p>
</div></td></tr><tr><td>filterFactory</td><td><a href="" class="label type-hint type-hint-function">Function</a></td><td><div class="angular-module-filter-page"><p>Factory function for creating new instance of filter.</p>
</div></td></tr></tbody></table></div>
</li>
<li><h3 id="provider">provider(name, providerType)</h3>
<div class="provider"><p>See <a href="api/AUTO.$provide#provider"><code>$provide.provider()</code></a>.</p><h4 id="Parameters">Parameters</h4>
<ul class="parameters"><li><code ng:non-bindable="">name {string} </code>
<p>service name</p></li>
<li><code ng:non-bindable="">providerType {Function} </code>
<p>Construction function for creating new instance of the service.</p></li>
</ul>
</div>
<div class="provider"><div class="angular-module-provider-page"><p>See <a href="api/AUTO.$provide#provider"><code>$provide.provider()</code></a>.</p>
</div><h5 id="parameters">Parameters</h5><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>name</td><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="angular-module-provider-page"><p>service name</p>
</div></td></tr><tr><td>providerType</td><td><a href="" class="label type-hint type-hint-function">Function</a></td><td><div class="angular-module-provider-page"><p>Construction function for creating new instance of the service.</p>
</div></td></tr></tbody></table></div>
</li>
<li><h3 id="run">run(initializationFn)</h3>
<div class="run"><p>Use this method to register work which should be performed when the injector is done
loading all modules.</p><h4 id="Parameters">Parameters</h4>
<ul class="parameters"><li><code ng:non-bindable="">initializationFn {Function} </code>
<p>Execute this function after injector creation.
Useful for application initialization.</p></li>
</ul>
</div>
<div class="run"><div class="angular-module-run-page"><p>Use this method to register work which should be performed when the injector is done
loading all modules.</p>
</div><h5 id="parameters">Parameters</h5><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>initializationFn</td><td><a href="" class="label type-hint type-hint-function">Function</a></td><td><div class="angular-module-run-page"><p>Execute this function after injector creation.
Useful for application initialization.</p>
</div></td></tr></tbody></table></div>
</li>
<li><h3 id="service">service(name, constructor)</h3>
<div class="service"><p>See <a href="api/AUTO.$provide#service"><code>$provide.service()</code></a>.</p><h4 id="Parameters">Parameters</h4>
<ul class="parameters"><li><code ng:non-bindable="">name {string} </code>
<p>service name</p></li>
<li><code ng:non-bindable="">constructor {Function} </code>
<p>A constructor function that will be instantiated.</p></li>
</ul>
</div>
<div class="service"><div class="angular-module-service-page"><p>See <a href="api/AUTO.$provide#service"><code>$provide.service()</code></a>.</p>
</div><h5 id="parameters">Parameters</h5><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>name</td><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="angular-module-service-page"><p>service name</p>
</div></td></tr><tr><td>constructor</td><td><a href="" class="label type-hint type-hint-function">Function</a></td><td><div class="angular-module-service-page"><p>A constructor function that will be instantiated.</p>
</div></td></tr></tbody></table></div>
</li>
<li><h3 id="value">value(name, object)</h3>
<div class="value"><p>See <a href="api/AUTO.$provide#value"><code>$provide.value()</code></a>.</p><h4 id="Parameters">Parameters</h4>
<ul class="parameters"><li><code ng:non-bindable="">name {string} </code>
<p>service name</p></li>
<li><code ng:non-bindable="">object {*} </code>
<p>Service instance object.</p></li>
</ul>
</div>
<div class="value"><div class="angular-module-value-page"><p>See <a href="api/AUTO.$provide#value"><code>$provide.value()</code></a>.</p>
</div><h5 id="parameters">Parameters</h5><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>name</td><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="angular-module-value-page"><p>service name</p>
</div></td></tr><tr><td>object</td><td><a href="" class="label type-hint type-hint-object">*</a></td><td><div class="angular-module-value-page"><p>Service instance object.</p>
</div></td></tr></tbody></table></div>
</li>
</ul>
</div>
<div class="member property"><h2 id="Properties">Properties</h2>
<ul class="properties"><li><h3 id="name">name</h3>
<div class="name"><h4 id="Returns">Returns</h4>
<div class="returns"><code ng:non-bindable="">{string}</code>
<p>Name of the module.</p></div>
</div>
<div class="name"><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="angular-module-name-page"><p>Name of the module.</p>
</div></td></tr></table></div>
</li>
<li><h3 id="requires">requires</h3>
<div class="requires"><p>Holds the list of modules which the injector will load before the current module is loaded.</p><h4 id="Returns">Returns</h4>
<div class="returns"><code ng:non-bindable="">{Array.&lt;string&gt;}</code>
<p>List of module names which must be loaded before this module.</p></div>
</div>
<div class="requires"><div class="angular-module-requires-page"><p>Holds the list of modules which the injector will load before the current module is loaded.</p>
</div><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-array">Array.&lt;string&gt;</a></td><td><div class="angular-module-requires-page"><p>List of module names which must be loaded before this module.</p>
</div></td></tr></table></div>
</li>
</ul>
</div>

33
lib/angular/docs/partials/api/angular.bind.html Normal file → Executable file
View file

@ -1,23 +1,18 @@
<h1><code ng:non-bindable="">angular.bind</code>
<span class="hint">(API in module <code ng:non-bindable="">ng</code>
)</span>
<a href="http://github.com/angular/angular.js/tree/v1.2.0rc1/src/Angular.js#L734" 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/Angular.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">angular.bind</code>
<div><span class="hint">API in module <code ng:non-bindable="">ng</code>
</span>
</div>
</h1>
<div><a href="http://github.com/angular/angular.js/edit/master/src/Angular.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p>Returns a function which calls function <code>fn</code> bound to <code>self</code> (<code>self</code> becomes the <code>this</code> for
<code>fn</code>). You can supply optional <code>args</code> that are are prebound to the function. This feature is also
known as <a href="http://en.wikipedia.org/wiki/Currying">function currying</a>.</p></div>
<div><h2 id="Description">Description</h2>
<div class="description"><div class="angular-bind-page"><p>Returns a function which calls function <code>fn</code> bound to <code>self</code> (<code>self</code> becomes the <code>this</code> for
<code>fn</code>). You can supply optional <code>args</code> that are prebound to the function. This feature is also
known as <a href="http://en.wikipedia.org/wiki/Currying">function currying</a>.</p>
</div></div>
<h2 id="Usage">Usage</h2>
<div class="usage"><pre class="prettyprint linenums">angular.bind(self, fn, args);</pre>
<h3 id="Parameters">Parameters</h3>
<ul class="parameters"><li><code ng:non-bindable="">self {Object} </code>
<p>Context which <code>fn</code> should be evaluated in.</p></li>
<li><code ng:non-bindable="">fn {function()} </code>
<p>Function to be bound.</p></li>
<li><code ng:non-bindable="">args {...*} </code>
<p>Optional arguments to be prebound to the <code>fn</code> function call.</p></li>
</ul>
<h3 id="Returns">Returns</h3>
<div class="returns"><code ng:non-bindable="">{function()}</code>
<p>Function that wraps the <code>fn</code> with all the specified bindings.</p></div>
</div>
<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>self</td><td><a href="" class="label type-hint type-hint-object">Object</a></td><td><div class="angular-bind-page"><p>Context which <code>fn</code> should be evaluated in.</p>
</div></td></tr><tr><td>fn</td><td><a href="" class="label type-hint type-hint-function">function()</a></td><td><div class="angular-bind-page"><p>Function to be bound.</p>
</div></td></tr><tr><td>args</td><td><a href="" class="label type-hint type-hint-object">...*</a></td><td><div class="angular-bind-page"><p>Optional arguments to be prebound to the <code>fn</code> function call.</p>
</div></td></tr></tbody></table><h4 id="returns">Returns</h4><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-function">function()</a></td><td><div class="angular-bind-page"><p>Function that wraps the <code>fn</code> with all the specified bindings.</p>
</div></td></tr></table></div>
</div>

31
lib/angular/docs/partials/api/angular.bootstrap.html Normal file → Executable file
View file

@ -1,21 +1,18 @@
<h1><code ng:non-bindable="">angular.bootstrap</code>
<span class="hint">(API in module <code ng:non-bindable="">ng</code>
)</span>
<a href="http://github.com/angular/angular.js/tree/v1.2.0rc1/src/Angular.js#L1034" 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/Angular.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">angular.bootstrap</code>
<div><span class="hint">API in module <code ng:non-bindable="">ng</code>
</span>
</div>
</h1>
<div><a href="http://github.com/angular/angular.js/edit/master/src/Angular.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p>Use this function to manually start up angular application.</p>
<p>See: <a href="guide/bootstrap">Bootstrap</a></p></div>
<div><h2 id="Description">Description</h2>
<div class="description"><div class="angular-bootstrap-page"><p>Use this function to manually start up angular application.</p>
<p>See: <a href="guide/bootstrap">Bootstrap</a></p>
<p>Note that ngScenario-based end-to-end tests cannot use this function to bootstrap manually.
They must use <a href="api/ng.directive:ngApp"><code>ngApp</code></a>.</p>
</div></div>
<h2 id="Usage">Usage</h2>
<div class="usage"><pre class="prettyprint linenums">angular.bootstrap(element[, modules]);</pre>
<h3 id="Parameters">Parameters</h3>
<ul class="parameters"><li><code ng:non-bindable="">element {Element} </code>
<p>DOM element which is the root of angular application.</p></li>
<li><code ng:non-bindable="">modules<i>(optional)</i> {Array&lt;String|Function&gt;=} </code>
<p>an array of module declarations. See: <a href="api/angular.module"><code>modules</code></a></p></li>
</ul>
<h3 id="Returns">Returns</h3>
<div class="returns"><code ng:non-bindable="">{AUTO.$injector}</code>
<p>Returns the newly created injector for this app.</p></div>
</div>
<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>element</td><td><a href="" class="label type-hint type-hint-element">Element</a></td><td><div class="angular-bootstrap-page"><p>DOM element which is the root of angular application.</p>
</div></td></tr><tr><td>modules <div><em>(optional)</em></div></td><td><a href="" class="label type-hint type-hint-array">Array&lt;String|Function&gt;</a></td><td><div class="angular-bootstrap-page"><p>an array of module declarations. See: <a href="api/angular.module"><code>modules</code></a></p>
</div></td></tr></tbody></table><h4 id="returns">Returns</h4><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-auto">AUTO.$injector</a></td><td><div class="angular-bootstrap-page"><p>Returns the newly created injector for this app.</p>
</div></td></tr></table></div>
</div>

34
lib/angular/docs/partials/api/angular.copy.html Normal file → Executable file
View file

@ -1,31 +1,25 @@
<h1><code ng:non-bindable="">angular.copy</code>
<span class="hint">(API in module <code ng:non-bindable="">ng</code>
)</span>
<a href="http://github.com/angular/angular.js/tree/v1.2.0rc1/src/Angular.js#L580" 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/Angular.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">angular.copy</code>
<div><span class="hint">API in module <code ng:non-bindable="">ng</code>
</span>
</div>
</h1>
<div><a href="http://github.com/angular/angular.js/edit/master/src/Angular.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p>Creates a deep copy of <code>source</code>, which should be an object or an array.</p>
<div><h2 id="Description">Description</h2>
<div class="description"><div class="angular-copy-page"><p>Creates a deep copy of <code>source</code>, which should be an object or an array.</p>
<ul>
<li>If no destination is supplied, a copy of the object or array is created.</li>
<li>If a destination is provided, all of its elements (for array) or properties (for objects)
are deleted and then all elements/properties from the source are copied to it.</li>
<li>If <code>source</code> is not an object or array, <code>source</code> is returned.</li>
</ul>
<p>Note: this function is used to augment the Object type in Angular expressions. See
<a href="api/ng.$filter"><code>ng.$filter</code></a> for more information about Angular arrays.</p></div>
<a href="api/ng.$filter"><code>ng.$filter</code></a> for more information about Angular arrays.</p>
</div></div>
<h2 id="Usage">Usage</h2>
<div class="usage"><pre class="prettyprint linenums">angular.copy(source[, destination]);</pre>
<h3 id="Parameters">Parameters</h3>
<ul class="parameters"><li><code ng:non-bindable="">source {*} </code>
<p>The source that will be used to make a copy.
Can be any type, including primitives, <code>null</code>, and <code>undefined</code>.</p></li>
<li><code ng:non-bindable="">destination<i>(optional)</i> {(Object|Array)=} </code>
<p>Destination into which the source is copied. If
provided, must be of the same type as <code>source</code>.</p></li>
</ul>
<h3 id="Returns">Returns</h3>
<div class="returns"><code ng:non-bindable="">{*}</code>
<p>The copy or updated <code>destination</code>, if <code>destination</code> was specified.</p></div>
</div>
<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>source</td><td><a href="" class="label type-hint type-hint-object">*</a></td><td><div class="angular-copy-page"><p>The source that will be used to make a copy.
Can be any type, including primitives, <code>null</code>, and <code>undefined</code>.</p>
</div></td></tr><tr><td>destination <div><em>(optional)</em></div></td><td><a href="" class="label type-hint type-hint-object">Object</a><a href="" class="label type-hint type-hint-array">Array</a></td><td><div class="angular-copy-page"><p>Destination into which the source is copied. If
provided, must be of the same type as <code>source</code>.</p>
</div></td></tr></tbody></table><h4 id="returns">Returns</h4><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-object">*</a></td><td><div class="angular-copy-page"><p>The copy or updated <code>destination</code>, if <code>destination</code> was specified.</p>
</div></td></tr></table></div>
</div>

63
lib/angular/docs/partials/api/angular.element.html Normal file → Executable file
View file

@ -1,43 +1,42 @@
<h1><code ng:non-bindable="">angular.element</code>
<span class="hint">(API in module <code ng:non-bindable="">ng</code>
)</span>
<a href="http://github.com/angular/angular.js/tree/v1.2.0rc1/src/jqLite.js#L7" 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/jqLite.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">angular.element</code>
<div><span class="hint">API in module <code ng:non-bindable="">ng</code>
</span>
</div>
</h1>
<div><a href="http://github.com/angular/angular.js/edit/master/src/jqLite.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p>Wraps a raw DOM element or HTML string as a <a href="http://jquery.com">jQuery</a> element.
<div><h2 id="Description">Description</h2>
<div class="description"><div class="angular-element-page"><p>Wraps a raw DOM element or HTML string as a <a href="http://jquery.com">jQuery</a> element.
<code>angular.element</code> can be either an alias for <a href="http://api.jquery.com/jQuery/">jQuery</a> function, if
jQuery is available, or a function that wraps the element or string in Angular's jQuery lite
jQuery is available, or a function that wraps the element or string in Angular&#39;s jQuery lite
implementation (commonly referred to as jqLite).</p>
<p>Real jQuery always takes precedence over jqLite, provided it was loaded before <code>DOMContentLoaded</code>
event fired.</p>
<p>jqLite is a tiny, API-compatible subset of jQuery that allows
Angular to manipulate the DOM. jqLite implements only the most commonly needed functionality
within a very small footprint, so only a subset of the jQuery API - methods, arguments and
invocation styles - are supported.</p>
<p>Note: All element references in Angular are always wrapped with jQuery or jqLite; they are never
raw DOM references.</p>
<h4>Angular's jQuery lite provides the following methods:</h4>
<h4>Angular&#39;s jqLite</h2>
<p>Angular&#39;s lite version of jQuery provides only the following jQuery methods:</p>
<ul>
<li><a href="http://api.jquery.com/addClass/">addClass()</a></li>
<li><a href="http://api.jquery.com/after/">after()</a></li>
<li><a href="http://api.jquery.com/append/">append()</a></li>
<li><a href="http://api.jquery.com/attr/">attr()</a></li>
<li><a href="http://api.jquery.com/bind/">bind()</a></li>
<li><a href="http://api.jquery.com/children/">children()</a></li>
<li><a href="http://api.jquery.com/on/">bind()</a> - Does not support namespaces, selectors or eventData</li>
<li><a href="http://api.jquery.com/children/">children()</a> - Does not support selectors</li>
<li><a href="http://api.jquery.com/clone/">clone()</a></li>
<li><a href="http://api.jquery.com/contents/">contents()</a></li>
<li><a href="http://api.jquery.com/css/">css()</a></li>
<li><a href="http://api.jquery.com/data/">data()</a></li>
<li><a href="http://api.jquery.com/eq/">eq()</a></li>
<li><a href="http://api.jquery.com/find/">find()</a> - Limited to lookups by tag name.</li>
<li><a href="http://api.jquery.com/find/">find()</a> - Limited to lookups by tag name</li>
<li><a href="http://api.jquery.com/hasClass/">hasClass()</a></li>
<li><a href="http://api.jquery.com/html/">html()</a></li>
<li><a href="http://api.jquery.com/next/">next()</a></li>
<li><a href="http://api.jquery.com/parent/">parent()</a></li>
<li><a href="http://api.jquery.com/next/">next()</a> - Does not support selectors</li>
<li><a href="http://api.jquery.com/on/">on()</a> - Does not support namespaces, selectors or eventData</li>
<li><a href="http://api.jquery.com/off/">off()</a> - Does not support namespaces or selectors</li>
<li><a href="http://api.jquery.com/parent/">parent()</a> - Does not support selectors</li>
<li><a href="http://api.jquery.com/prepend/">prepend()</a></li>
<li><a href="http://api.jquery.com/prop/">prop()</a></li>
<li><a href="http://api.jquery.com/ready/">ready()</a></li>
@ -48,33 +47,33 @@ raw DOM references.</p>
<li><a href="http://api.jquery.com/replaceWith/">replaceWith()</a></li>
<li><a href="http://api.jquery.com/text/">text()</a></li>
<li><a href="http://api.jquery.com/toggleClass/">toggleClass()</a></li>
<li><a href="http://api.jquery.com/triggerHandler/">triggerHandler()</a> - Doesn't pass native event objects to handlers.</li>
<li><a href="http://api.jquery.com/unbind/">unbind()</a></li>
<li><a href="http://api.jquery.com/triggerHandler/">triggerHandler()</a> - Passes a dummy event object to handlers.</li>
<li><a href="http://api.jquery.com/off/">unbind()</a> - Does not support namespaces</li>
<li><a href="http://api.jquery.com/val/">val()</a></li>
<li><a href="http://api.jquery.com/wrap/">wrap()</a></li>
</ul>
<h4>In addition to the above, Angular provides additional methods to both jQuery and jQuery lite:</h4>
<h2>jQuery/jqLite Extras</h4>
<p>Angular also provides the following additional methods and events to both jQuery and jqLite:</p>
<h5>Events</h3>
<ul>
<li><code>$destroy</code> - AngularJS intercepts all jqLite/jQuery&#39;s DOM destruction apis and fires this event
on all DOM nodes being removed. This can be used to clean up and 3rd party bindings to the DOM
element before it is removed.<h3>Methods</h5>
</li>
<li><code>controller(name)</code> - retrieves the controller of the current element or its parent. By default
retrieves controller associated with the <code>ngController</code> directive. If <code>name</code> is provided as
camelCase directive name, then the controller for this directive will be retrieved (e.g.
<code>'ngModel'</code>).</li>
<code>&#39;ngModel&#39;</code>).</li>
<li><code>injector()</code> - retrieves the injector of the current element or its parent.</li>
<li><code>scope()</code> - retrieves the <a href="api/ng.$rootScope.Scope"><code>scope</code></a> of the current
element or its parent.</li>
<li><code>inheritedData()</code> - same as <code>data()</code>, but walks up the DOM until a value is found or the top
parent element is reached.</li>
</ul></div>
</ul>
</div></div>
<h2 id="Usage">Usage</h2>
<div class="usage"><pre class="prettyprint linenums">angular.element(element);</pre>
<h3 id="Parameters">Parameters</h3>
<ul class="parameters"><li><code ng:non-bindable="">element {string|DOMElement} </code>
<p>HTML string or DOMElement to be wrapped into jQuery.</p></li>
</ul>
<h3 id="Returns">Returns</h3>
<div class="returns"><code ng:non-bindable="">{Object}</code>
<p>jQuery object.</p></div>
</div>
<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>element</td><td><a href="" class="label type-hint type-hint-string">string</a><a href="" class="label type-hint type-hint-domelement">DOMElement</a></td><td><div class="angular-element-page"><p>HTML string or DOMElement to be wrapped into jQuery.</p>
</div></td></tr></tbody></table><h4 id="returns">Returns</h4><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-object">Object</a></td><td><div class="angular-element-page"><p>jQuery object.</p>
</div></td></tr></table></div>
</div>

37
lib/angular/docs/partials/api/angular.equals.html Normal file → Executable file
View file

@ -1,33 +1,28 @@
<h1><code ng:non-bindable="">angular.equals</code>
<span class="hint">(API in module <code ng:non-bindable="">ng</code>
)</span>
<a href="http://github.com/angular/angular.js/tree/v1.2.0rc1/src/Angular.js#L657" 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/Angular.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">angular.equals</code>
<div><span class="hint">API in module <code ng:non-bindable="">ng</code>
</span>
</div>
</h1>
<div><a href="http://github.com/angular/angular.js/edit/master/src/Angular.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p>Determines if two objects or two values are equivalent. Supports value types, arrays and
<div><h2 id="Description">Description</h2>
<div class="description"><div class="angular-equals-page"><p>Determines if two objects or two values are equivalent. Supports value types, regular expressions, arrays and
objects.</p>
<p>Two objects or values are considered equivalent if at least one of the following is true:</p>
<ul>
<li>Both objects or values pass <code>===</code> comparison.</li>
<li>Both objects or values are of the same type and all of their properties pass <code>===</code> comparison.</li>
<li>Both values are NaN. (In JavasScript, NaN == NaN => false. But we consider two NaN as equal)</li>
<li>Both values are NaN. (In JavasScript, NaN == NaN =&gt; false. But we consider two NaN as equal)</li>
<li>Both values represent the same regular expression (In JavasScript,
/abc/ == /abc/ =&gt; false. But we consider two regular expressions as equal when their textual
representation matches).</li>
</ul>
<p>During a property comparison, properties of <code>function</code> type and properties with names
that begin with <code>$</code> are ignored.</p>
<p>Scope and DOMWindow objects are being compared only be identify (<code>===</code>).</p></div>
<p>Scope and DOMWindow objects are being compared only by identify (<code>===</code>).</p>
</div></div>
<h2 id="Usage">Usage</h2>
<div class="usage"><pre class="prettyprint linenums">angular.equals(o1, o2);</pre>
<h3 id="Parameters">Parameters</h3>
<ul class="parameters"><li><code ng:non-bindable="">o1 {*} </code>
<p>Object or value to compare.</p></li>
<li><code ng:non-bindable="">o2 {*} </code>
<p>Object or value to compare.</p></li>
</ul>
<h3 id="Returns">Returns</h3>
<div class="returns"><code ng:non-bindable="">{boolean}</code>
<p>True if arguments are equal.</p></div>
</div>
<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>o1</td><td><a href="" class="label type-hint type-hint-object">*</a></td><td><div class="angular-equals-page"><p>Object or value to compare.</p>
</div></td></tr><tr><td>o2</td><td><a href="" class="label type-hint type-hint-object">*</a></td><td><div class="angular-equals-page"><p>Object or value to compare.</p>
</div></td></tr></tbody></table><h4 id="returns">Returns</h4><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-boolean">boolean</a></td><td><div class="angular-equals-page"><p>True if arguments are equal.</p>
</div></td></tr></table></div>
</div>

25
lib/angular/docs/partials/api/angular.extend.html Normal file → Executable file
View file

@ -1,17 +1,16 @@
<h1><code ng:non-bindable="">angular.extend</code>
<span class="hint">(API in module <code ng:non-bindable="">ng</code>
)</span>
<a href="http://github.com/angular/angular.js/tree/v1.2.0rc1/src/Angular.js#L223" 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/Angular.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">angular.extend</code>
<div><span class="hint">API in module <code ng:non-bindable="">ng</code>
</span>
</div>
</h1>
<div><a href="http://github.com/angular/angular.js/edit/master/src/Angular.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p>Extends the destination object <code>dst</code> by copying all of the properties from the <code>src</code> object(s)
to <code>dst</code>. You can specify multiple <code>src</code> objects.</p></div>
<div><h2 id="Description">Description</h2>
<div class="description"><div class="angular-extend-page"><p>Extends the destination object <code>dst</code> by copying all of the properties from the <code>src</code> object(s)
to <code>dst</code>. You can specify multiple <code>src</code> objects.</p>
</div></div>
<h2 id="Usage">Usage</h2>
<div class="usage"><pre class="prettyprint linenums">angular.extend(dst, src);</pre>
<h3 id="Parameters">Parameters</h3>
<ul class="parameters"><li><code ng:non-bindable="">dst {Object} </code>
<p>Destination object.</p></li>
<li><code ng:non-bindable="">src {...Object} </code>
<p>Source object(s).</p></li>
</ul>
</div>
<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>dst</td><td><a href="" class="label type-hint type-hint-object">Object</a></td><td><div class="angular-extend-page"><p>Destination object.</p>
</div></td></tr><tr><td>src</td><td><a href="" class="label type-hint type-hint-object">...Object</a></td><td><div class="angular-extend-page"><p>Source object(s).</p>
</div></td></tr></tbody></table><h4 id="returns">Returns</h4><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-object">Object</a></td><td><div class="angular-extend-page"><p>Reference to <code>dst</code>.</p>
</div></td></tr></table></div>
</div>

35
lib/angular/docs/partials/api/angular.forEach.html Normal file → Executable file
View file

@ -1,35 +1,28 @@
<h1><code ng:non-bindable="">angular.forEach</code>
<span class="hint">(API in module <code ng:non-bindable="">ng</code>
)</span>
<a href="http://github.com/angular/angular.js/tree/v1.2.0rc1/src/Angular.js#L98" 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/Angular.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">angular.forEach</code>
<div><span class="hint">API in module <code ng:non-bindable="">ng</code>
</span>
</div>
</h1>
<div><a href="http://github.com/angular/angular.js/edit/master/src/Angular.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p>Invokes the <code>iterator</code> function once for each item in <code>obj</code> collection, which can be either an
<div><h2 id="Description">Description</h2>
<div class="description"><div class="angular-foreach-page"><p>Invokes the <code>iterator</code> function once for each item in <code>obj</code> collection, which can be either an
object or an array. The <code>iterator</code> function is invoked with <code>iterator(value, key)</code>, where <code>value</code>
is the value of an object property or an array element and <code>key</code> is the object property key or
array element index. Specifying a <code>context</code> for the function is optional.</p>
<p>Note: this function was previously known as <code>angular.foreach</code>.</p>
<pre class="prettyprint linenums">
<p> <pre class="prettyprint linenums">
var values = {name: 'misko', gender: 'male'};
var log = [];
angular.forEach(values, function(value, key){
this.push(key + ': ' + value);
}, log);
expect(log).toEqual(['name: misko', 'gender:male']);
</pre></div>
</pre>
</div></div>
<h2 id="Usage">Usage</h2>
<div class="usage"><pre class="prettyprint linenums">angular.forEach(obj, iterator[, context]);</pre>
<h3 id="Parameters">Parameters</h3>
<ul class="parameters"><li><code ng:non-bindable="">obj {Object|Array} </code>
<p>Object to iterate over.</p></li>
<li><code ng:non-bindable="">iterator {Function} </code>
<p>Iterator function.</p></li>
<li><code ng:non-bindable="">context<i>(optional)</i> {Object=} </code>
<p>Object to become context (<code>this</code>) for the iterator function.</p></li>
</ul>
<h3 id="Returns">Returns</h3>
<div class="returns"><code ng:non-bindable="">{Object|Array}</code>
<p>Reference to <code>obj</code>.</p></div>
</div>
<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>obj</td><td><a href="" class="label type-hint type-hint-object">Object</a><a href="" class="label type-hint type-hint-array">Array</a></td><td><div class="angular-foreach-page"><p>Object to iterate over.</p>
</div></td></tr><tr><td>iterator</td><td><a href="" class="label type-hint type-hint-function">Function</a></td><td><div class="angular-foreach-page"><p>Iterator function.</p>
</div></td></tr><tr><td>context <div><em>(optional)</em></div></td><td><a href="" class="label type-hint type-hint-object">Object</a></td><td><div class="angular-foreach-page"><p>Object to become context (<code>this</code>) for the iterator function.</p>
</div></td></tr></tbody></table><h4 id="returns">Returns</h4><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-object">Object|Array</a></td><td><div class="angular-foreach-page"><p>Reference to <code>obj</code>.</p>
</div></td></tr></table></div>
</div>

23
lib/angular/docs/partials/api/angular.fromJson.html Normal file → Executable file
View file

@ -1,17 +1,14 @@
<h1><code ng:non-bindable="">angular.fromJson</code>
<span class="hint">(API in module <code ng:non-bindable="">ng</code>
)</span>
<a href="http://github.com/angular/angular.js/tree/v1.2.0rc1/src/Angular.js#L806" 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/Angular.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">angular.fromJson</code>
<div><span class="hint">API in module <code ng:non-bindable="">ng</code>
</span>
</div>
</h1>
<div><a href="http://github.com/angular/angular.js/edit/master/src/Angular.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p>Deserializes a JSON string.</p></div>
<div><h2 id="Description">Description</h2>
<div class="description"><div class="angular-fromjson-page"><p>Deserializes a JSON string.</p>
</div></div>
<h2 id="Usage">Usage</h2>
<div class="usage"><pre class="prettyprint linenums">angular.fromJson(json);</pre>
<h3 id="Parameters">Parameters</h3>
<ul class="parameters"><li><code ng:non-bindable="">json {string} </code>
<p>JSON string to deserialize.</p></li>
</ul>
<h3 id="Returns">Returns</h3>
<div class="returns"><code ng:non-bindable="">{Object|Array|Date|string|number}</code>
<p>Deserialized thingy.</p></div>
</div>
<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>json</td><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="angular-fromjson-page"><p>JSON string to deserialize.</p>
</div></td></tr></tbody></table><h4 id="returns">Returns</h4><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-object">Object|Array|Date|string|number</a></td><td><div class="angular-fromjson-page"><p>Deserialized thingy.</p>
</div></td></tr></table></div>
</div>

19
lib/angular/docs/partials/api/angular.identity.html Normal file → Executable file
View file

@ -1,16 +1,17 @@
<h1><code ng:non-bindable="">angular.identity</code>
<span class="hint">(API in module <code ng:non-bindable="">ng</code>
)</span>
<a href="http://github.com/angular/angular.js/tree/v1.2.0rc1/src/Angular.js#L278" 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/Angular.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">angular.identity</code>
<div><span class="hint">API in module <code ng:non-bindable="">ng</code>
</span>
</div>
</h1>
<div><a href="http://github.com/angular/angular.js/edit/master/src/Angular.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p>A function that returns its first argument. This function is useful when writing code in the
<div><h2 id="Description">Description</h2>
<div class="description"><div class="angular-identity-page"><p>A function that returns its first argument. This function is useful when writing code in the
functional style.</p>
<pre class="prettyprint linenums">
<p> <pre class="prettyprint linenums">
function transformer(transformationFn, value) {
return (transformationFn || identity)(value);
return (transformationFn || angular.identity)(value);
};
</pre></div>
</pre>
</div></div>
<h2 id="Usage">Usage</h2>
<div class="usage"><pre class="prettyprint linenums">angular.identity();</pre>
</div>

32
lib/angular/docs/partials/api/angular.injector.html Normal file → Executable file
View file

@ -1,23 +1,20 @@
<h1><code ng:non-bindable="">angular.injector</code>
<span class="hint">(API in module <code ng:non-bindable="">ng</code>
)</span>
<a href="http://github.com/angular/angular.js/tree/v1.2.0rc1/src/auto/injector.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/auto/injector.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">angular.injector</code>
<div><span class="hint">API in module <code ng:non-bindable="">ng</code>
</span>
</div>
</h1>
<div><a href="http://github.com/angular/angular.js/edit/master/src/auto/injector.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p>Creates an injector function that can be used for retrieving services as well as for
dependency injection (see <a href="guide/di">dependency injection</a>).</p></div>
<div><h2 id="Description">Description</h2>
<div class="description"><div class="angular-injector-page"><p>Creates an injector function that can be used for retrieving services as well as for
dependency injection (see <a href="guide/di">dependency injection</a>).</p>
</div></div>
<h2 id="Usage">Usage</h2>
<div class="usage"><pre class="prettyprint linenums">angular.injector(modules);</pre>
<h3 id="Parameters">Parameters</h3>
<ul class="parameters"><li><code ng:non-bindable="">modules {Array.&lt;string|Function&gt;} </code>
<p>A list of module functions or their aliases. See
<a href="api/angular.module"><code>angular.module</code></a>. The <code>ng</code> module must be explicitly added.</p></li>
</ul>
<h3 id="Returns">Returns</h3>
<div class="returns"><code ng:non-bindable="">{function()}</code>
<p>Injector function. See <a href="api/AUTO.$injector"><code>$injector</code></a>.</p></div>
</div>
<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>modules</td><td><a href="" class="label type-hint type-hint-array">Array.&lt;string|Function&gt;</a></td><td><div class="angular-injector-page"><p>A list of module functions or their aliases. See
<a href="api/angular.module"><code>angular.module</code></a>. The <code>ng</code> module must be explicitly added.</p>
</div></td></tr></tbody></table><h4 id="returns">Returns</h4><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-function">function()</a></td><td><div class="angular-injector-page"><p>Injector function. See <a href="api/AUTO.$injector"><code>$injector</code></a>.</p>
</div></td></tr></table></div>
<h2 id="Example">Example</h2>
<div class="example"><p>Typical usage
<div class="example"><div class="angular-injector-page"><p>Typical usage
<pre class="prettyprint linenums">
// create an injector
var $injector = angular.injector(['ng']);
@ -28,5 +25,6 @@ dependency injection (see <a href="guide/di">dependency injection</a>).</p></div
$compile($document)($rootScope);
$rootScope.$digest();
});
</pre></div>
</pre>
</div></div>
</div>

23
lib/angular/docs/partials/api/angular.isArray.html Normal file → Executable file
View file

@ -1,17 +1,14 @@
<h1><code ng:non-bindable="">angular.isArray</code>
<span class="hint">(API in module <code ng:non-bindable="">ng</code>
)</span>
<a href="http://github.com/angular/angular.js/tree/v1.2.0rc1/src/Angular.js#L386" 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/Angular.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">angular.isArray</code>
<div><span class="hint">API in module <code ng:non-bindable="">ng</code>
</span>
</div>
</h1>
<div><a href="http://github.com/angular/angular.js/edit/master/src/Angular.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p>Determines if a reference is an <code>Array</code>.</p></div>
<div><h2 id="Description">Description</h2>
<div class="description"><div class="angular-isarray-page"><p>Determines if a reference is an <code>Array</code>.</p>
</div></div>
<h2 id="Usage">Usage</h2>
<div class="usage"><pre class="prettyprint linenums">angular.isArray(value);</pre>
<h3 id="Parameters">Parameters</h3>
<ul class="parameters"><li><code ng:non-bindable="">value {*} </code>
<p>Reference to check.</p></li>
</ul>
<h3 id="Returns">Returns</h3>
<div class="returns"><code ng:non-bindable="">{boolean}</code>
<p>True if <code>value</code> is an <code>Array</code>.</p></div>
</div>
<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>value</td><td><a href="" class="label type-hint type-hint-object">*</a></td><td><div class="angular-isarray-page"><p>Reference to check.</p>
</div></td></tr></tbody></table><h4 id="returns">Returns</h4><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-boolean">boolean</a></td><td><div class="angular-isarray-page"><p>True if <code>value</code> is an <code>Array</code>.</p>
</div></td></tr></table></div>
</div>

23
lib/angular/docs/partials/api/angular.isDate.html Normal file → Executable file
View file

@ -1,17 +1,14 @@
<h1><code ng:non-bindable="">angular.isDate</code>
<span class="hint">(API in module <code ng:non-bindable="">ng</code>
)</span>
<a href="http://github.com/angular/angular.js/tree/v1.2.0rc1/src/Angular.js#L370" 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/Angular.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">angular.isDate</code>
<div><span class="hint">API in module <code ng:non-bindable="">ng</code>
</span>
</div>
</h1>
<div><a href="http://github.com/angular/angular.js/edit/master/src/Angular.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p>Determines if a value is a date.</p></div>
<div><h2 id="Description">Description</h2>
<div class="description"><div class="angular-isdate-page"><p>Determines if a value is a date.</p>
</div></div>
<h2 id="Usage">Usage</h2>
<div class="usage"><pre class="prettyprint linenums">angular.isDate(value);</pre>
<h3 id="Parameters">Parameters</h3>
<ul class="parameters"><li><code ng:non-bindable="">value {*} </code>
<p>Reference to check.</p></li>
</ul>
<h3 id="Returns">Returns</h3>
<div class="returns"><code ng:non-bindable="">{boolean}</code>
<p>True if <code>value</code> is a <code>Date</code>.</p></div>
</div>
<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>value</td><td><a href="" class="label type-hint type-hint-object">*</a></td><td><div class="angular-isdate-page"><p>Reference to check.</p>
</div></td></tr></tbody></table><h4 id="returns">Returns</h4><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-boolean">boolean</a></td><td><div class="angular-isdate-page"><p>True if <code>value</code> is a <code>Date</code>.</p>
</div></td></tr></table></div>
</div>

23
lib/angular/docs/partials/api/angular.isDefined.html Normal file → Executable file
View file

@ -1,17 +1,14 @@
<h1><code ng:non-bindable="">angular.isDefined</code>
<span class="hint">(API in module <code ng:non-bindable="">ng</code>
)</span>
<a href="http://github.com/angular/angular.js/tree/v1.2.0rc1/src/Angular.js#L313" 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/Angular.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">angular.isDefined</code>
<div><span class="hint">API in module <code ng:non-bindable="">ng</code>
</span>
</div>
</h1>
<div><a href="http://github.com/angular/angular.js/edit/master/src/Angular.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p>Determines if a reference is defined.</p></div>
<div><h2 id="Description">Description</h2>
<div class="description"><div class="angular-isdefined-page"><p>Determines if a reference is defined.</p>
</div></div>
<h2 id="Usage">Usage</h2>
<div class="usage"><pre class="prettyprint linenums">angular.isDefined(value);</pre>
<h3 id="Parameters">Parameters</h3>
<ul class="parameters"><li><code ng:non-bindable="">value {*} </code>
<p>Reference to check.</p></li>
</ul>
<h3 id="Returns">Returns</h3>
<div class="returns"><code ng:non-bindable="">{boolean}</code>
<p>True if <code>value</code> is defined.</p></div>
</div>
<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>value</td><td><a href="" class="label type-hint type-hint-object">*</a></td><td><div class="angular-isdefined-page"><p>Reference to check.</p>
</div></td></tr></tbody></table><h4 id="returns">Returns</h4><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-boolean">boolean</a></td><td><div class="angular-isdefined-page"><p>True if <code>value</code> is defined.</p>
</div></td></tr></table></div>
</div>

23
lib/angular/docs/partials/api/angular.isElement.html Normal file → Executable file
View file

@ -1,17 +1,14 @@
<h1><code ng:non-bindable="">angular.isElement</code>
<span class="hint">(API in module <code ng:non-bindable="">ng</code>
)</span>
<a href="http://github.com/angular/angular.js/tree/v1.2.0rc1/src/Angular.js#L470" 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/Angular.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">angular.isElement</code>
<div><span class="hint">API in module <code ng:non-bindable="">ng</code>
</span>
</div>
</h1>
<div><a href="http://github.com/angular/angular.js/edit/master/src/Angular.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p>Determines if a reference is a DOM element (or wrapped jQuery element).</p></div>
<div><h2 id="Description">Description</h2>
<div class="description"><div class="angular-iselement-page"><p>Determines if a reference is a DOM element (or wrapped jQuery element).</p>
</div></div>
<h2 id="Usage">Usage</h2>
<div class="usage"><pre class="prettyprint linenums">angular.isElement(value);</pre>
<h3 id="Parameters">Parameters</h3>
<ul class="parameters"><li><code ng:non-bindable="">value {*} </code>
<p>Reference to check.</p></li>
</ul>
<h3 id="Returns">Returns</h3>
<div class="returns"><code ng:non-bindable="">{boolean}</code>
<p>True if <code>value</code> is a DOM element (or wrapped jQuery element).</p></div>
</div>
<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>value</td><td><a href="" class="label type-hint type-hint-object">*</a></td><td><div class="angular-iselement-page"><p>Reference to check.</p>
</div></td></tr></tbody></table><h4 id="returns">Returns</h4><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-boolean">boolean</a></td><td><div class="angular-iselement-page"><p>True if <code>value</code> is a DOM element (or wrapped jQuery element).</p>
</div></td></tr></table></div>
</div>

23
lib/angular/docs/partials/api/angular.isFunction.html Normal file → Executable file
View file

@ -1,17 +1,14 @@
<h1><code ng:non-bindable="">angular.isFunction</code>
<span class="hint">(API in module <code ng:non-bindable="">ng</code>
)</span>
<a href="http://github.com/angular/angular.js/tree/v1.2.0rc1/src/Angular.js#L402" 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/Angular.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">angular.isFunction</code>
<div><span class="hint">API in module <code ng:non-bindable="">ng</code>
</span>
</div>
</h1>
<div><a href="http://github.com/angular/angular.js/edit/master/src/Angular.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p>Determines if a reference is a <code>Function</code>.</p></div>
<div><h2 id="Description">Description</h2>
<div class="description"><div class="angular-isfunction-page"><p>Determines if a reference is a <code>Function</code>.</p>
</div></div>
<h2 id="Usage">Usage</h2>
<div class="usage"><pre class="prettyprint linenums">angular.isFunction(value);</pre>
<h3 id="Parameters">Parameters</h3>
<ul class="parameters"><li><code ng:non-bindable="">value {*} </code>
<p>Reference to check.</p></li>
</ul>
<h3 id="Returns">Returns</h3>
<div class="returns"><code ng:non-bindable="">{boolean}</code>
<p>True if <code>value</code> is a <code>Function</code>.</p></div>
</div>
<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>value</td><td><a href="" class="label type-hint type-hint-object">*</a></td><td><div class="angular-isfunction-page"><p>Reference to check.</p>
</div></td></tr></tbody></table><h4 id="returns">Returns</h4><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-boolean">boolean</a></td><td><div class="angular-isfunction-page"><p>True if <code>value</code> is a <code>Function</code>.</p>
</div></td></tr></table></div>
</div>

23
lib/angular/docs/partials/api/angular.isNumber.html Normal file → Executable file
View file

@ -1,17 +1,14 @@
<h1><code ng:non-bindable="">angular.isNumber</code>
<span class="hint">(API in module <code ng:non-bindable="">ng</code>
)</span>
<a href="http://github.com/angular/angular.js/tree/v1.2.0rc1/src/Angular.js#L356" 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/Angular.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">angular.isNumber</code>
<div><span class="hint">API in module <code ng:non-bindable="">ng</code>
</span>
</div>
</h1>
<div><a href="http://github.com/angular/angular.js/edit/master/src/Angular.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p>Determines if a reference is a <code>Number</code>.</p></div>
<div><h2 id="Description">Description</h2>
<div class="description"><div class="angular-isnumber-page"><p>Determines if a reference is a <code>Number</code>.</p>
</div></div>
<h2 id="Usage">Usage</h2>
<div class="usage"><pre class="prettyprint linenums">angular.isNumber(value);</pre>
<h3 id="Parameters">Parameters</h3>
<ul class="parameters"><li><code ng:non-bindable="">value {*} </code>
<p>Reference to check.</p></li>
</ul>
<h3 id="Returns">Returns</h3>
<div class="returns"><code ng:non-bindable="">{boolean}</code>
<p>True if <code>value</code> is a <code>Number</code>.</p></div>
</div>
<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>value</td><td><a href="" class="label type-hint type-hint-object">*</a></td><td><div class="angular-isnumber-page"><p>Reference to check.</p>
</div></td></tr></tbody></table><h4 id="returns">Returns</h4><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-boolean">boolean</a></td><td><div class="angular-isnumber-page"><p>True if <code>value</code> is a <code>Number</code>.</p>
</div></td></tr></table></div>
</div>

25
lib/angular/docs/partials/api/angular.isObject.html Normal file → Executable file
View file

@ -1,18 +1,15 @@
<h1><code ng:non-bindable="">angular.isObject</code>
<span class="hint">(API in module <code ng:non-bindable="">ng</code>
)</span>
<a href="http://github.com/angular/angular.js/tree/v1.2.0rc1/src/Angular.js#L327" 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/Angular.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">angular.isObject</code>
<div><span class="hint">API in module <code ng:non-bindable="">ng</code>
</span>
</div>
</h1>
<div><a href="http://github.com/angular/angular.js/edit/master/src/Angular.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p>Determines if a reference is an <code>Object</code>. Unlike <code>typeof</code> in JavaScript, <code>null</code>s are not
considered to be objects.</p></div>
<div><h2 id="Description">Description</h2>
<div class="description"><div class="angular-isobject-page"><p>Determines if a reference is an <code>Object</code>. Unlike <code>typeof</code> in JavaScript, <code>null</code>s are not
considered to be objects.</p>
</div></div>
<h2 id="Usage">Usage</h2>
<div class="usage"><pre class="prettyprint linenums">angular.isObject(value);</pre>
<h3 id="Parameters">Parameters</h3>
<ul class="parameters"><li><code ng:non-bindable="">value {*} </code>
<p>Reference to check.</p></li>
</ul>
<h3 id="Returns">Returns</h3>
<div class="returns"><code ng:non-bindable="">{boolean}</code>
<p>True if <code>value</code> is an <code>Object</code> but not <code>null</code>.</p></div>
</div>
<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>value</td><td><a href="" class="label type-hint type-hint-object">*</a></td><td><div class="angular-isobject-page"><p>Reference to check.</p>
</div></td></tr></tbody></table><h4 id="returns">Returns</h4><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-boolean">boolean</a></td><td><div class="angular-isobject-page"><p>True if <code>value</code> is an <code>Object</code> but not <code>null</code>.</p>
</div></td></tr></table></div>
</div>

23
lib/angular/docs/partials/api/angular.isString.html Normal file → Executable file
View file

@ -1,17 +1,14 @@
<h1><code ng:non-bindable="">angular.isString</code>
<span class="hint">(API in module <code ng:non-bindable="">ng</code>
)</span>
<a href="http://github.com/angular/angular.js/tree/v1.2.0rc1/src/Angular.js#L342" 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/Angular.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">angular.isString</code>
<div><span class="hint">API in module <code ng:non-bindable="">ng</code>
</span>
</div>
</h1>
<div><a href="http://github.com/angular/angular.js/edit/master/src/Angular.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p>Determines if a reference is a <code>String</code>.</p></div>
<div><h2 id="Description">Description</h2>
<div class="description"><div class="angular-isstring-page"><p>Determines if a reference is a <code>String</code>.</p>
</div></div>
<h2 id="Usage">Usage</h2>
<div class="usage"><pre class="prettyprint linenums">angular.isString(value);</pre>
<h3 id="Parameters">Parameters</h3>
<ul class="parameters"><li><code ng:non-bindable="">value {*} </code>
<p>Reference to check.</p></li>
</ul>
<h3 id="Returns">Returns</h3>
<div class="returns"><code ng:non-bindable="">{boolean}</code>
<p>True if <code>value</code> is a <code>String</code>.</p></div>
</div>
<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>value</td><td><a href="" class="label type-hint type-hint-object">*</a></td><td><div class="angular-isstring-page"><p>Reference to check.</p>
</div></td></tr></tbody></table><h4 id="returns">Returns</h4><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-boolean">boolean</a></td><td><div class="angular-isstring-page"><p>True if <code>value</code> is a <code>String</code>.</p>
</div></td></tr></table></div>
</div>

23
lib/angular/docs/partials/api/angular.isUndefined.html Normal file → Executable file
View file

@ -1,17 +1,14 @@
<h1><code ng:non-bindable="">angular.isUndefined</code>
<span class="hint">(API in module <code ng:non-bindable="">ng</code>
)</span>
<a href="http://github.com/angular/angular.js/tree/v1.2.0rc1/src/Angular.js#L299" 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/Angular.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">angular.isUndefined</code>
<div><span class="hint">API in module <code ng:non-bindable="">ng</code>
</span>
</div>
</h1>
<div><a href="http://github.com/angular/angular.js/edit/master/src/Angular.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p>Determines if a reference is undefined.</p></div>
<div><h2 id="Description">Description</h2>
<div class="description"><div class="angular-isundefined-page"><p>Determines if a reference is undefined.</p>
</div></div>
<h2 id="Usage">Usage</h2>
<div class="usage"><pre class="prettyprint linenums">angular.isUndefined(value);</pre>
<h3 id="Parameters">Parameters</h3>
<ul class="parameters"><li><code ng:non-bindable="">value {*} </code>
<p>Reference to check.</p></li>
</ul>
<h3 id="Returns">Returns</h3>
<div class="returns"><code ng:non-bindable="">{boolean}</code>
<p>True if <code>value</code> is undefined.</p></div>
</div>
<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>value</td><td><a href="" class="label type-hint type-hint-object">*</a></td><td><div class="angular-isundefined-page"><p>Reference to check.</p>
</div></td></tr></tbody></table><h4 id="returns">Returns</h4><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-boolean">boolean</a></td><td><div class="angular-isundefined-page"><p>True if <code>value</code> is undefined.</p>
</div></td></tr></table></div>
</div>

23
lib/angular/docs/partials/api/angular.lowercase.html Normal file → Executable file
View file

@ -1,17 +1,14 @@
<h1><code ng:non-bindable="">angular.lowercase</code>
<span class="hint">(API in module <code ng:non-bindable="">ng</code>
)</span>
<a href="http://github.com/angular/angular.js/tree/v1.2.0rc1/src/Angular.js#L15" 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/Angular.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">angular.lowercase</code>
<div><span class="hint">API in module <code ng:non-bindable="">ng</code>
</span>
</div>
</h1>
<div><a href="http://github.com/angular/angular.js/edit/master/src/Angular.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p>Converts the specified string to lowercase.</p></div>
<div><h2 id="Description">Description</h2>
<div class="description"><div class="angular-lowercase-page"><p>Converts the specified string to lowercase.</p>
</div></div>
<h2 id="Usage">Usage</h2>
<div class="usage"><pre class="prettyprint linenums">angular.lowercase(string);</pre>
<h3 id="Parameters">Parameters</h3>
<ul class="parameters"><li><code ng:non-bindable="">string {string} </code>
<p>String to be converted to lowercase.</p></li>
</ul>
<h3 id="Returns">Returns</h3>
<div class="returns"><code ng:non-bindable="">{string}</code>
<p>Lowercased string.</p></div>
</div>
<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>string</td><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="angular-lowercase-page"><p>String to be converted to lowercase.</p>
</div></td></tr></tbody></table><h4 id="returns">Returns</h4><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="angular-lowercase-page"><p>Lowercased string.</p>
</div></td></tr></table></div>
</div>

37
lib/angular/docs/partials/api/angular.mock.TzDate.html Normal file → Executable file
View file

@ -1,33 +1,27 @@
<h1><code ng:non-bindable="">angular.mock.TzDate</code>
<span class="hint">(API in module <code ng:non-bindable="">ng</code>
)</span>
<a href="http://github.com/angular/angular.js/tree/v1.2.0rc1/src/ngMock/angular-mocks.js#L495" 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/ngMock/angular-mocks.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">angular.mock.TzDate</code>
<div><span class="hint">API in module <code ng:non-bindable="">ng</code>
</span>
</div>
</h1>
<div><a href="http://github.com/angular/angular.js/edit/master/src/ngMock/angular-mocks.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p><em>NOTE</em>: this is not an injectable instance, just a globally available mock class of <code>Date</code>.</p>
<div><h2 id="Description">Description</h2>
<div class="description"><div class="angular-mock-tzdate-page"><p><em>NOTE</em>: this is not an injectable instance, just a globally available mock class of <code>Date</code>.</p>
<p>Mock of the Date type which has its timezone specified via constructor arg.</p>
<p>The main purpose is to create Date-like instances with timezone fixed to the specified timezone
offset, so that we can test code that depends on local timezone settings without dependency on
the time zone settings of the machine where the code is running.</p></div>
the time zone settings of the machine where the code is running.</p>
</div></div>
<h2 id="Usage">Usage</h2>
<div class="usage"><pre class="prettyprint linenums">TzDate(offset, timestamp);</pre>
<h3 id="Parameters">Parameters</h3>
<ul class="parameters"><li><code ng:non-bindable="">offset {number} </code>
<p>Offset of the <em>desired</em> timezone in hours (fractions will be honored)</p></li>
<li><code ng:non-bindable="">timestamp {(number|string)} </code>
<p>Timestamp representing the desired time in <em>UTC</em></p></li>
</ul>
</div>
<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>offset</td><td><a href="" class="label type-hint type-hint-number">number</a></td><td><div class="angular-mock-tzdate-page"><p>Offset of the <em>desired</em> timezone in hours (fractions will be honored)</p>
</div></td></tr><tr><td>timestamp</td><td><a href="" class="label type-hint type-hint-number">number</a><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="angular-mock-tzdate-page"><p>Timestamp representing the desired time in <em>UTC</em></p>
</div></td></tr></tbody></table></div>
<h2 id="Example">Example</h2>
<div class="example"><p>!!!! WARNING !!!!!
<div class="example"><div class="angular-mock-tzdate-page"><p>!!!! WARNING !!!!!
This is not a complete Date object so only methods that were implemented can be called safely.
To make matters worse, TzDate instances inherit stuff from Date via a prototype.</p>
<p>We do our best to intercept calls to "unimplemented" methods, but since the list of methods is
<p>We do our best to intercept calls to &quot;unimplemented&quot; methods, but since the list of methods is
incomplete we might be missing some non-standard methods. This can result in errors like:
"Date.prototype.foo called on incompatible Object".</p>
&quot;Date.prototype.foo called on incompatible Object&quot;.</p>
<pre class="prettyprint linenums">
var newYearInBratislava = new TzDate(-1, '2009-12-31T23:00:00Z');
newYearInBratislava.getTimezoneOffset() =&gt; -60;
@ -37,5 +31,6 @@ newYearInBratislava.getDate() =&gt; 1;
newYearInBratislava.getHours() =&gt; 0;
newYearInBratislava.getMinutes() =&gt; 0;
newYearInBratislava.getSeconds() =&gt; 0;
</pre></div>
</pre>
</div></div>
</div>

View file

@ -1,25 +0,0 @@
<h1><code ng:non-bindable="">angular.mock.createMockWindow</code>
<span class="hint">(API in module <code ng:non-bindable="">ng</code>
)</span>
</h1>
<div><a href="http://github.com/angular/angular.js/edit/master/src/ngMock/angular-mocks.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p>This function creates a mock window object useful for controlling access ot setTimeout, but mocking out
sufficient window's properties to allow Angular to execute.</p></div>
<h2 id="Usage">Usage</h2>
<div class="usage"><pre class="prettyprint linenums">angular.mock.createMockWindow();</pre>
</div>
<h2 id="Example">Example</h2>
<div class="example"><pre class="prettyprint linenums">
beforeEach(module(function($provide) {
$provide.value('$window', window = angular.mock.createMockWindow());
}));
it('should do something', inject(function($window) {
var val = null;
$window.setTimeout(function() { val = 123; }, 10);
expect(val).toEqual(null);
window.setTimeout.expect(10).process();
expect(val).toEqual(123);
});
</pre></div>
</div>

View file

@ -1,23 +0,0 @@
<h1><code ng:non-bindable="">angular.mock.debug</code>
<span class="hint">(API in module <code ng:non-bindable="">ng</code>
)</span>
</h1>
<div><h2 id="Description">Description</h2>
<div class="description"><p><em>NOTE</em>: this is not an injectable instance, just a globally available function.</p>
<p>Method for serializing common angular objects (scope, elements, etc..) into strings, useful for debugging.</p>
<p>This method is also available on window, where it can be used to display objects on debug console.</p></div>
<h2 id="Usage">Usage</h2>
<div class="usage"><pre class="prettyprint linenums">angular.mock.debug(object);</pre>
<h3 id="Parameters">Parameters</h3>
<ul class="parameters"><li><code ng:non-bindable="">object {*} </code>
<ul>
<li>any object to turn into string.</li>
</ul></li>
</ul>
<h3 id="Returns">Returns</h3>
<div class="returns"><code ng:non-bindable="">{string}</code>
<p>a serialized string of the argument</p></div>
</div>
</div>

27
lib/angular/docs/partials/api/angular.mock.dump.html Normal file → Executable file
View file

@ -1,23 +1,18 @@
<h1><code ng:non-bindable="">angular.mock.dump</code>
<span class="hint">(API in module <code ng:non-bindable="">ng</code>
)</span>
<a href="http://github.com/angular/angular.js/tree/v1.2.0rc1/src/ngMock/angular-mocks.js#L697" 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/ngMock/angular-mocks.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">angular.mock.dump</code>
<div><span class="hint">API in module <code ng:non-bindable="">ng</code>
</span>
</div>
</h1>
<div><a href="http://github.com/angular/angular.js/edit/master/src/ngMock/angular-mocks.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p><em>NOTE</em>: this is not an injectable instance, just a globally available function.</p>
<div><h2 id="Description">Description</h2>
<div class="description"><div class="angular-mock-dump-page"><p><em>NOTE</em>: this is not an injectable instance, just a globally available function.</p>
<p>Method for serializing common angular objects (scope, elements, etc..) into strings, useful for debugging.</p>
<p>This method is also available on window, where it can be used to display objects on debug console.</p></div>
<p>This method is also available on window, where it can be used to display objects on debug console.</p>
</div></div>
<h2 id="Usage">Usage</h2>
<div class="usage"><pre class="prettyprint linenums">angular.mock.dump(object);</pre>
<h3 id="Parameters">Parameters</h3>
<ul class="parameters"><li><code ng:non-bindable="">object {*} </code>
<ul>
<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>object</td><td><a href="" class="label type-hint type-hint-object">*</a></td><td><div class="angular-mock-dump-page"><ul>
<li>any object to turn into string.</li>
</ul></li>
</ul>
<h3 id="Returns">Returns</h3>
<div class="returns"><code ng:non-bindable="">{string}</code>
<p>a serialized string of the argument</p></div>
</div>
</div></td></tr></tbody></table><h4 id="returns">Returns</h4><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="angular-mock-dump-page"><p>a serialized string of the argument</p>
</div></td></tr></table></div>
</div>

10
lib/angular/docs/partials/api/angular.mock.html Normal file → Executable file
View file

@ -1,5 +1,7 @@
<h1><code ng:non-bindable="">angular.mock</code>
<span class="hint">(API in module <code ng:non-bindable="">ng</code>
)</span>
<a href="http://github.com/angular/angular.js/tree/v1.2.0rc1/src/ngMock/angular-mocks.js#L9" 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/ngMock/angular-mocks.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">angular.mock</code>
<div><span class="hint">API in module <code ng:non-bindable="">ng</code>
</span>
</div>
</h1>
<div><a href="http://github.com/angular/angular.js/edit/master/src/ngMock/angular-mocks.js" class="improve-docs btn btn-primary">Improve this doc</a><p>Namespace from 'angular-mocks.js' which contains testing related code.</p></div>
<div><div class="angular-mock-page"><p>Namespace from &#39;angular-mocks.js&#39; which contains testing related code.</p>
</div></div>

24
lib/angular/docs/partials/api/angular.mock.inject.html Normal file → Executable file
View file

@ -1,16 +1,14 @@
<h1><code ng:non-bindable="">angular.mock.inject</code>
<span class="hint">(API in module <code ng:non-bindable="">ng</code>
)</span>
<a href="http://github.com/angular/angular.js/tree/v1.2.0rc1/src/ngMock/angular-mocks.js#L1874" 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/ngMock/angular-mocks.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">angular.mock.inject</code>
<div><span class="hint">API in module <code ng:non-bindable="">ng</code>
</span>
</div>
</h1>
<div><a href="http://github.com/angular/angular.js/edit/master/src/ngMock/angular-mocks.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p><em>NOTE</em>: This function is also published on window for easy access.<br></p>
<div><h2 id="Description">Description</h2>
<div class="description"><div class="angular-mock-inject-page"><p><em>NOTE</em>: This function is also published on window for easy access.<br></p>
<p>The inject function wraps a function into an injectable function. The inject() creates new
instance of <a href="api/AUTO.$injector"><code>$injector</code></a> per test, which is then used for
resolving references.</p>
<p>See also <a href="api/angular.mock.module"><code>module</code></a></p>
<p>Example of what a typical jasmine tests looks like with the inject method.
<pre class="prettyprint linenums">
@ -46,12 +44,10 @@ resolving references.</p>
));
});
</pre></div>
</pre>
</div></div>
<h2 id="Usage">Usage</h2>
<div class="usage"><pre class="prettyprint linenums">angular.mock.inject(fns);</pre>
<h3 id="Parameters">Parameters</h3>
<ul class="parameters"><li><code ng:non-bindable="">fns {...Function} </code>
<p>any number of functions which will be injected using the injector.</p></li>
</ul>
</div>
<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>fns</td><td><a href="" class="label type-hint type-hint-object">...Function</a></td><td><div class="angular-mock-inject-page"><p>any number of functions which will be injected using the injector.</p>
</div></td></tr></tbody></table></div>
</div>

25
lib/angular/docs/partials/api/angular.mock.module.html Normal file → Executable file
View file

@ -1,21 +1,18 @@
<h1><code ng:non-bindable="">angular.mock.module</code>
<span class="hint">(API in module <code ng:non-bindable="">ng</code>
)</span>
<a href="http://github.com/angular/angular.js/tree/v1.2.0rc1/src/ngMock/angular-mocks.js#L1842" 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/ngMock/angular-mocks.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">angular.mock.module</code>
<div><span class="hint">API in module <code ng:non-bindable="">ng</code>
</span>
</div>
</h1>
<div><a href="http://github.com/angular/angular.js/edit/master/src/ngMock/angular-mocks.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p><em>NOTE</em>: This function is also published on window for easy access.<br></p>
<div><h2 id="Description">Description</h2>
<div class="description"><div class="angular-mock-module-page"><p><em>NOTE</em>: This function is also published on window for easy access.<br></p>
<p>This function registers a module configuration code. It collects the configuration information
which will be used when the injector is created by <a href="api/angular.mock.inject"><code>inject</code></a>.</p>
<p>See <a href="api/angular.mock.inject"><code>inject</code></a> for usage example</p></div>
<p>See <a href="api/angular.mock.inject"><code>inject</code></a> for usage example</p>
</div></div>
<h2 id="Usage">Usage</h2>
<div class="usage"><pre class="prettyprint linenums">angular.mock.module(fns);</pre>
<h3 id="Parameters">Parameters</h3>
<ul class="parameters"><li><code ng:non-bindable="">fns {...(string|Function)} </code>
<p>any number of modules which are represented as string
<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>fns</td><td><a href="" class="label type-hint type-hint-object">...(string</a><a href="" class="label type-hint type-hint-function">Function</a></td><td><div class="angular-mock-module-page"><p>any number of modules which are represented as string
aliases or as anonymous module initialization functions. The modules are used to
configure the injector. The 'ng' and 'ngMock' modules are automatically loaded.</p></li>
</ul>
</div>
configure the injector. The &#39;ng&#39; and &#39;ngMock&#39; modules are automatically loaded.</p>
</div></td></tr></tbody></table></div>
</div>

47
lib/angular/docs/partials/api/angular.module.html Normal file → Executable file
View file

@ -1,17 +1,15 @@
<h1><code ng:non-bindable="">angular.module</code>
<span class="hint">(API in module <code ng:non-bindable="">ng</code>
)</span>
<a href="http://github.com/angular/angular.js/tree/v1.2.0rc1/src/loader.js#L21" 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/loader.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">angular.module</code>
<div><span class="hint">API in module <code ng:non-bindable="">ng</code>
</span>
</div>
</h1>
<div><a href="http://github.com/angular/angular.js/edit/master/src/loader.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p>The <code>angular.module</code> is a global place for creating and registering Angular modules. All
<div><h2 id="Description">Description</h2>
<div class="description"><div class="angular-module-page"><p>The <code>angular.module</code> is a global place for creating and registering Angular modules. All
modules (angular core or 3rd party) that should be available to an application must be
registered using this mechanism.</p>
<h3>Module</h3>
<p>A module is a collocation of services, directives, filters, and configuration information. Module
is used to configure the <a href="api/AUTO.$injector"><code>$injector</code></a>.</p>
<p>A module is a collection of services, directives, filters, and configuration information.
<code>angular.module</code> is used to configure the <a href="api/AUTO.$injector"><code>$injector</code></a>.</p>
<pre class="prettyprint linenums">
// Create a new module
var myModule = angular.module('myModule', []);
@ -25,30 +23,21 @@ myModule.config(function($locationProvider) {
$locationProvider.hashPrefix('!');
});
</pre>
<p>Then you can create an injector and load your modules like this:</p>
<pre class="prettyprint linenums">
var injector = angular.injector(['ng', 'MyModule'])
</pre>
<p>However it's more likely that you'll just use
<p>However it&#39;s more likely that you&#39;ll just use
<a href="api/ng.directive:ngApp"><code>ngApp</code></a> or
<a href="api/angular.bootstrap"><code>angular.bootstrap</code></a> to simplify this process for you.</p></div>
<a href="api/angular.bootstrap"><code>angular.bootstrap</code></a> to simplify this process for you.</p>
</div></div>
<h2 id="Usage">Usage</h2>
<div class="usage"><pre class="prettyprint linenums">angular.module(name[, requires], configFn);</pre>
<h3 id="Parameters">Parameters</h3>
<ul class="parameters"><li><code ng:non-bindable="">name {!string} </code>
<p>The name of the module to create or retrieve.</p></li>
<li><code ng:non-bindable="">requires<i>(optional)</i> {Array.&lt;string&gt;=} </code>
<p>If specified then new module is being created. If unspecified then the
the module is being retrieved for further configuration.</p></li>
<li><code ng:non-bindable="">configFn {Function} </code>
<p>Optional configuration function for the module. Same as
<a href="api/angular.Module#config"><code>Module#config()</code></a>.</p></li>
</ul>
<h3 id="Returns">Returns</h3>
<div class="returns"><code ng:non-bindable="">{module}</code>
<p>new module with the <a href="api/angular.Module"><code>angular.Module</code></a> api.</p></div>
</div>
<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>name</td><td><a href="" class="label type-hint type-hint-object">!string</a></td><td><div class="angular-module-page"><p>The name of the module to create or retrieve.</p>
</div></td></tr><tr><td>requires <div><em>(optional)</em></div></td><td><a href="" class="label type-hint type-hint-array">Array.&lt;string&gt;</a></td><td><div class="angular-module-page"><p>If specified then new module is being created. If unspecified then the
the module is being retrieved for further configuration.</p>
</div></td></tr><tr><td>configFn</td><td><a href="" class="label type-hint type-hint-function">Function</a></td><td><div class="angular-module-page"><p>Optional configuration function for the module. Same as
<a href="api/angular.Module#config"><code>Module#config()</code></a>.</p>
</div></td></tr></tbody></table><h4 id="returns">Returns</h4><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-module">module</a></td><td><div class="angular-module-page"><p>new module with the <a href="api/angular.Module"><code>angular.Module</code></a> api.</p>
</div></td></tr></table></div>
</div>

View file

@ -1,15 +0,0 @@
<h1><code ng:non-bindable="">angular.noConflict</code>
<span class="hint">(API in module <code ng:non-bindable="">ng</code>
)</span>
</h1>
<div><a href="http://github.com/angular/angular.js/edit/master/src/Angular.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p>Restores the previous global value of angular and returns the current instance. Other libraries may already use the
angular namespace. Or a previous version of angular is already loaded on the page. In these cases you may want to
restore the previous namespace and keep a reference to angular.</p></div>
<h2 id="Usage">Usage</h2>
<div class="usage"><pre class="prettyprint linenums">angular.noConflict();</pre>
<h3 id="Returns">Returns</h3>
<div class="returns"><code ng:non-bindable="">{Object}</code>
<p>The current angular namespace</p></div>
</div>
</div>

14
lib/angular/docs/partials/api/angular.noop.html Normal file → Executable file
View file

@ -1,16 +1,18 @@
<h1><code ng:non-bindable="">angular.noop</code>
<span class="hint">(API in module <code ng:non-bindable="">ng</code>
)</span>
<a href="http://github.com/angular/angular.js/tree/v1.2.0rc1/src/Angular.js#L259" 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/Angular.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">angular.noop</code>
<div><span class="hint">API in module <code ng:non-bindable="">ng</code>
</span>
</div>
</h1>
<div><a href="http://github.com/angular/angular.js/edit/master/src/Angular.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p>A function that performs no operations. This function can be useful when writing code in the
<div><h2 id="Description">Description</h2>
<div class="description"><div class="angular-noop-page"><p>A function that performs no operations. This function can be useful when writing code in the
functional style.
<pre class="prettyprint linenums">
function foo(callback) {
var result = calculateResult();
(callback || angular.noop)(result);
}
</pre></div>
</pre>
</div></div>
<h2 id="Usage">Usage</h2>
<div class="usage"><pre class="prettyprint linenums">angular.noop();</pre>
</div>

27
lib/angular/docs/partials/api/angular.toJson.html Normal file → Executable file
View file

@ -1,19 +1,16 @@
<h1><code ng:non-bindable="">angular.toJson</code>
<span class="hint">(API in module <code ng:non-bindable="">ng</code>
)</span>
<a href="http://github.com/angular/angular.js/tree/v1.2.0rc1/src/Angular.js#L787" 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/Angular.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">angular.toJson</code>
<div><span class="hint">API in module <code ng:non-bindable="">ng</code>
</span>
</div>
</h1>
<div><a href="http://github.com/angular/angular.js/edit/master/src/Angular.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p>Serializes input into a JSON-formatted string.</p></div>
<div><h2 id="Description">Description</h2>
<div class="description"><div class="angular-tojson-page"><p>Serializes input into a JSON-formatted string. Properties with leading $ characters will be
stripped since angular uses this notation internally.</p>
</div></div>
<h2 id="Usage">Usage</h2>
<div class="usage"><pre class="prettyprint linenums">angular.toJson(obj[, pretty]);</pre>
<h3 id="Parameters">Parameters</h3>
<ul class="parameters"><li><code ng:non-bindable="">obj {Object|Array|Date|string|number} </code>
<p>Input to be serialized into JSON.</p></li>
<li><code ng:non-bindable="">pretty<i>(optional)</i> {boolean=} </code>
<p>If set to true, the JSON output will contain newlines and whitespace.</p></li>
</ul>
<h3 id="Returns">Returns</h3>
<div class="returns"><code ng:non-bindable="">{string}</code>
<p>Jsonified string representing <code>obj</code>.</p></div>
</div>
<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>obj</td><td><a href="" class="label type-hint type-hint-object">Object</a><a href="" class="label type-hint type-hint-array">Array</a><a href="" class="label type-hint type-hint-date">Date</a><a href="" class="label type-hint type-hint-string">string</a><a href="" class="label type-hint type-hint-number">number</a></td><td><div class="angular-tojson-page"><p>Input to be serialized into JSON.</p>
</div></td></tr><tr><td>pretty <div><em>(optional)</em></div></td><td><a href="" class="label type-hint type-hint-boolean">boolean</a></td><td><div class="angular-tojson-page"><p>If set to true, the JSON output will contain newlines and whitespace.</p>
</div></td></tr></tbody></table><h4 id="returns">Returns</h4><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-string">string|undefined</a></td><td><div class="angular-tojson-page"><p>JSON-ified string representing <code>obj</code>.</p>
</div></td></tr></table></div>
</div>

23
lib/angular/docs/partials/api/angular.uppercase.html Normal file → Executable file
View file

@ -1,17 +1,14 @@
<h1><code ng:non-bindable="">angular.uppercase</code>
<span class="hint">(API in module <code ng:non-bindable="">ng</code>
)</span>
<a href="http://github.com/angular/angular.js/tree/v1.2.0rc1/src/Angular.js#L27" 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/Angular.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">angular.uppercase</code>
<div><span class="hint">API in module <code ng:non-bindable="">ng</code>
</span>
</div>
</h1>
<div><a href="http://github.com/angular/angular.js/edit/master/src/Angular.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p>Converts the specified string to uppercase.</p></div>
<div><h2 id="Description">Description</h2>
<div class="description"><div class="angular-uppercase-page"><p>Converts the specified string to uppercase.</p>
</div></div>
<h2 id="Usage">Usage</h2>
<div class="usage"><pre class="prettyprint linenums">angular.uppercase(string);</pre>
<h3 id="Parameters">Parameters</h3>
<ul class="parameters"><li><code ng:non-bindable="">string {string} </code>
<p>String to be converted to uppercase.</p></li>
</ul>
<h3 id="Returns">Returns</h3>
<div class="returns"><code ng:non-bindable="">{string}</code>
<p>Uppercased string.</p></div>
</div>
<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>string</td><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="angular-uppercase-page"><p>String to be converted to uppercase.</p>
</div></td></tr></tbody></table><h4 id="returns">Returns</h4><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="angular-uppercase-page"><p>Uppercased string.</p>
</div></td></tr></table></div>
</div>

25
lib/angular/docs/partials/api/angular.version.html Normal file → Executable file
View file

@ -1,18 +1,19 @@
<h1><code ng:non-bindable="">angular.version</code>
<span class="hint">(API in module <code ng:non-bindable="">ng</code>
)</span>
<a href="http://github.com/angular/angular.js/tree/v1.2.0rc1/src/AngularPublic.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/AngularPublic.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">angular.version</code>
<div><span class="hint">API in module <code ng:non-bindable="">ng</code>
</span>
</div>
</h1>
<div><a href="http://github.com/angular/angular.js/edit/master/src/AngularPublic.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p>An object that contains information about the current AngularJS version. This object has the
<div><h2 id="Description">Description</h2>
<div class="description"><div class="angular-version-page"><p>An object that contains information about the current AngularJS version. This object has the
following properties:</p>
<ul>
<li><code>full</code> <code>{string}</code> Full version string, such as "0.9.18".</li>
<li><code>major</code> <code>{number}</code> Major version number, such as "0".</li>
<li><code>minor</code> <code>{number}</code> Minor version number, such as "9".</li>
<li><code>dot</code> <code>{number}</code> Dot version number, such as "18".</li>
<li><code>codeName</code> <code>{string}</code> Code name of the release, such as "jiggling-armfat".</li>
</ul></div>
<li><code>full</code> <code>{string}</code> Full version string, such as &quot;0.9.18&quot;.</li>
<li><code>major</code> <code>{number}</code> Major version number, such as &quot;0&quot;.</li>
<li><code>minor</code> <code>{number}</code> Minor version number, such as &quot;9&quot;.</li>
<li><code>dot</code> <code>{number}</code> Dot version number, such as &quot;18&quot;.</li>
<li><code>codeName</code> <code>{string}</code> Code name of the release, such as &quot;jiggling-armfat&quot;.</li>
</ul>
</div></div>
<h2 id="Usage">Usage</h2>
<div class="usage"><pre class="prettyprint linenums">angular.version</pre>
</div>

12
lib/angular/docs/partials/api/index.html Normal file → Executable file
View file

@ -1,6 +1,8 @@
<h1><code ng:non-bindable=""></code>
<span class="hint"></span>
<a href="http://github.com/angular/angular.js/tree/v1.2.0rc1/docs/content/api/index.ngdoc#L1" 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/docs/content/api/index.ngdoc" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable=""></code>
<div><span class="hint"></span>
</div>
</h1>
<div><a href="http://github.com/angular/angular.js/edit/master/docs/content/api/index.ngdoc" class="improve-docs btn btn-primary">Improve this doc</a><p>Use the API Reference documentation when you need more information about a specific feature. Check out
<a href="guide/index">Developer Guide</a> for AngularJS concepts. If you are new to AngularJS we recommend the
<a href="tutorial/index">Tutorial</a>.</p></div>
<div><div class="api-reference-page"><p>Use the API Reference documentation when you need more information about a specific feature. Check out
<a href="../../../../../index.htmlx">Developer Guide</a> for AngularJS concepts. If you are new to AngularJS we recommend the
<a href="../../../../../index.htmlndex">Tutorial</a>.</p>
</div></div>

15
lib/angular/docs/partials/api/ng.$anchorScroll.html Normal file → Executable file
View file

@ -1,14 +1,15 @@
<h1><code ng:non-bindable="">$anchorScroll</code>
<span class="hint">(service in module <code ng:non-bindable="">ng</code>
)</span>
<a href="http://github.com/angular/angular.js/tree/v1.2.0rc1/src/ng/anchorScroll.js#L1" 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/anchorScroll.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">$anchorScroll</code>
<div><span class="hint">service in module <code ng:non-bindable="">ng</code>
</span>
</div>
</h1>
<div><a href="http://github.com/angular/angular.js/edit/master/src/ng/anchorScroll.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p>When called, it checks current value of <code>$location.hash()</code> and scroll to related element,
<div><h2 id="Description">Description</h2>
<div class="description"><div class="ng-anchorscroll-page"><p>When called, it checks current value of <code>$location.hash()</code> and scroll to related element,
according to rules specified in
<a href="http://dev.w3.org/html5/spec/Overview.html#the-indicated-part-of-the-document">Html5 spec</a>.</p>
<p>It also watches the <code>$location.hash()</code> and scroll whenever it changes to match any anchor.
This can be disabled by calling <code>$anchorScrollProvider.disableAutoScrolling()</code>.</p></div>
This can be disabled by calling <code>$anchorScrollProvider.disableAutoScrolling()</code>.</p>
</div></div>
<h2 id="Dependencies">Dependencies</h2>
<ul class="dependencies"><li><code ng:non-bindable=""><a href="api/ng.$window">$window</a></code>
</li>

View file

@ -0,0 +1,56 @@
<a href="http://github.com/angular/angular.js/tree/v1.2.0rc1/src/ng/animate.js#L61" 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/animate.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">$animate</code>
<div><span class="hint">service in module <code ng:non-bindable="">ng</code>
</span>
</div>
</h1>
<div><h2 id="Description">Description</h2>
<div class="description"><div class="ng-animate-page"><p>The $animate service provides rudimentary DOM manipulation functions to insert, remove, move elements within
the DOM as well as adding and removing classes. This service is the core service used by the ngAnimate $animator
service which provides high-level animation hooks for CSS and JavaScript. </p>
<p>$animate is available in the AngularJS core, however, the ngAnimate module must be included to enable full out
animation support. Otherwise, $animate will only perform simple DOM manipulation operations.</p>
<p>To learn more about enabling animation support, click here to visit the <a href="api/ngAnimate">ngAnimate module page</a>
as well as the <a href="api/ngAnimate.$animate">ngAnimate $animate service page</a>.</p>
</div></div>
<div class="member method"><h2 id="Methods">Methods</h2>
<ul class="methods"><li><h3 id="addClass">addClass(element, className, done)</h3>
<div class="addclass"><div class="ng-animate-addclass-page"><p>Adds the provided className CSS class value to the provided element. Once complete, the done() callback will be fired (if provided).</p>
</div><h5 id="parameters">Parameters</h5><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>element</td><td><a href="" class="label type-hint type-hint-jquery">jQuery/jqLite element</a></td><td><div class="ng-animate-addclass-page"><p>the element which will have the className value added to it</p>
</div></td></tr><tr><td>className</td><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="ng-animate-addclass-page"><p>the CSS class which will be added to the element</p>
</div></td></tr><tr><td>done <div><em>(optional)</em></div></td><td><a href="" class="label type-hint type-hint-function">function</a></td><td><div class="ng-animate-addclass-page"><p>the callback function (if provided) that will be fired after the className value has been added to the element</p>
</div></td></tr></tbody></table></div>
</li>
<li><h3 id="enter">enter(element, parent, after, done)</h3>
<div class="enter"><div class="ng-animate-enter-page"><p>Inserts the element into the DOM either after the <code>after</code> element or within the <code>parent</code> element. Once complete,
the done() callback will be fired (if provided).</p>
</div><h5 id="parameters">Parameters</h5><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>element</td><td><a href="" class="label type-hint type-hint-jquery">jQuery/jqLite element</a></td><td><div class="ng-animate-enter-page"><p>the element which will be inserted into the DOM</p>
</div></td></tr><tr><td>parent</td><td><a href="" class="label type-hint type-hint-jquery">jQuery/jqLite element</a></td><td><div class="ng-animate-enter-page"><p>the parent element which will append the element as a child (if the after element is not present)</p>
</div></td></tr><tr><td>after</td><td><a href="" class="label type-hint type-hint-jquery">jQuery/jqLite element</a></td><td><div class="ng-animate-enter-page"><p>the sibling element which will append the element after itself</p>
</div></td></tr><tr><td>done <div><em>(optional)</em></div></td><td><a href="" class="label type-hint type-hint-function">function</a></td><td><div class="ng-animate-enter-page"><p>callback function that will be called after the element has been inserted into the DOM</p>
</div></td></tr></tbody></table></div>
</li>
<li><h3 id="leave">leave(element, done)</h3>
<div class="leave"><div class="ng-animate-leave-page"><p>Removes the element from the DOM. Once complete, the done() callback will be fired (if provided).</p>
</div><h5 id="parameters">Parameters</h5><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>element</td><td><a href="" class="label type-hint type-hint-jquery">jQuery/jqLite element</a></td><td><div class="ng-animate-leave-page"><p>the element which will be removed from the DOM</p>
</div></td></tr><tr><td>done <div><em>(optional)</em></div></td><td><a href="" class="label type-hint type-hint-function">function</a></td><td><div class="ng-animate-leave-page"><p>callback function that will be called after the element has been removed from the DOM</p>
</div></td></tr></tbody></table></div>
</li>
<li><h3 id="move">move(element, parent, after, done)</h3>
<div class="move"><div class="ng-animate-move-page"><p>Moves the position of the provided element within the DOM to be placed either after the <code>after</code> element or inside of the <code>parent</code> element.
Once complete, the done() callback will be fired (if provided).</p>
</div><h5 id="parameters">Parameters</h5><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>element</td><td><a href="" class="label type-hint type-hint-jquery">jQuery/jqLite element</a></td><td><div class="ng-animate-move-page"><p>the element which will be moved around within the DOM</p>
</div></td></tr><tr><td>parent</td><td><a href="" class="label type-hint type-hint-jquery">jQuery/jqLite element</a></td><td><div class="ng-animate-move-page"><p>the parent element where the element will be inserted into (if the after element is not present)</p>
</div></td></tr><tr><td>after</td><td><a href="" class="label type-hint type-hint-jquery">jQuery/jqLite element</a></td><td><div class="ng-animate-move-page"><p>the sibling element where the element will be positioned next to</p>
</div></td></tr><tr><td>done <div><em>(optional)</em></div></td><td><a href="" class="label type-hint type-hint-function">function</a></td><td><div class="ng-animate-move-page"><p>the callback function (if provided) that will be fired after the element has been moved to it&#39;s new position</p>
</div></td></tr></tbody></table></div>
</li>
<li><h3 id="removeClass">removeClass(element, className, done)</h3>
<div class="removeclass"><div class="ng-animate-removeclass-page"><p>Removes the provided className CSS class value from the provided element. Once complete, the done() callback will be fired (if provided).</p>
</div><h5 id="parameters">Parameters</h5><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>element</td><td><a href="" class="label type-hint type-hint-jquery">jQuery/jqLite element</a></td><td><div class="ng-animate-removeclass-page"><p>the element which will have the className value removed from it</p>
</div></td></tr><tr><td>className</td><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="ng-animate-removeclass-page"><p>the CSS class which will be removed from the element</p>
</div></td></tr><tr><td>done <div><em>(optional)</em></div></td><td><a href="" class="label type-hint type-hint-function">function</a></td><td><div class="ng-animate-removeclass-page"><p>the callback function (if provided) that will be fired after the className value has been removed from the element</p>
</div></td></tr></tbody></table></div>
</li>
</ul>
</div>
</div>

View file

@ -0,0 +1,38 @@
<a href="http://github.com/angular/angular.js/tree/v1.2.0rc1/src/ng/animate.js#L5" 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/animate.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">$animateProvider</code>
<div><span class="hint">service in module <code ng:non-bindable="">ng</code>
</span>
</div>
</h1>
<div><h2 id="Description">Description</h2>
<div class="description"><div class="ng-animateprovider-page"><p>Default implementation of $animate that doesn&#39;t perform any animations, instead just synchronously performs DOM
updates and calls done() callbacks.</p>
<p>In order to enable animations the ngAnimate module has to be loaded.</p>
<p>To see the functional implementation check out src/ngAnimate/animate.js</p>
</div></div>
<div class="member method"><h2 id="Methods">Methods</h2>
<ul class="methods"><li><h3 id="register">register(name, factory)</h3>
<div class="register"><div class="ng-animateprovider-register-page"><p>Registers a new injectable animation factory function. The factory function produces the animation object which
contains callback functions for each event that is expected to be animated.</p>
<ul>
<li><code>eventFn</code>: <code>function(Element, doneFunction)</code> The element to animate, the <code>doneFunction</code> must be called once the
element animation is complete. If a function is returned then the animation service will use this function to
cancel the animation whenever a cancel event is triggered.</li>
</ul>
<pre class="prettyprint linenums">
return {
eventFn : function(element, done) {
//code to run the animation
//once complete, then run done()
return function cancellationFunction() {
//code to cancel the animation
}
}
}
</pre>
</div><h5 id="parameters">Parameters</h5><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>name</td><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="ng-animateprovider-register-page"><p>The name of the animation.</p>
</div></td></tr><tr><td>factory</td><td><a href="" class="label type-hint type-hint-function">function</a></td><td><div class="ng-animateprovider-register-page"><p>The factory function that will be executed to return the animation object.</p>
</div></td></tr></tbody></table></div>
</li>
</ul>
</div>
</div>

View file

@ -1,20 +0,0 @@
<h1><code ng:non-bindable="">$animation</code>
<span class="hint">(service in module <code ng:non-bindable="">ng</code>
)</span>
</h1>
<div><a href="http://github.com/angular/angular.js/edit/master/src/ng/animation.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p>The $animation service is used to retrieve any defined animation functions. When executed, the $animation service
will return a object that contains the setup and start functions that were defined for the animation.</p></div>
<h2 id="Usage">Usage</h2>
<div class="usage"><pre class="prettyprint linenums">$animation(name);</pre>
<h3 id="Parameters">Parameters</h3>
<ul class="parameters"><li><code ng:non-bindable="">name {String} </code>
<p>Name of the animation function to retrieve. Animation functions are registered and stored
inside of the AngularJS DI so a call to $animate('custom') is the same as injecting <code>customAnimation</code>
via dependency injection.</p></li>
</ul>
<h3 id="Returns">Returns</h3>
<div class="returns"><code ng:non-bindable="">{Object}</code>
<p>the animation object which contains the <code>setup</code> and <code>start</code> functions that perform the animation.</p></div>
</div>
</div>

View file

@ -1,29 +0,0 @@
<h1><code ng:non-bindable="">$animationProvider</code>
<span class="hint">(service in module <code ng:non-bindable="">ng</code>
)</span>
</h1>
<div><a href="http://github.com/angular/angular.js/edit/master/src/ng/animation.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p>The $AnimationProvider provider allows developers to register and access custom JavaScript animations directly inside
of a module.</p></div>
<div class="member method"><h2 id="Methods">Methods</h2>
<ul class="methods"><li><h3 id="register">register(name, factory)</h3>
<div class="register"><p>Registers a new injectable animation factory function. The factory function produces the animation object which
has these two properties:</p>
<ul>
<li><code>setup</code>: <code>function(Element):*</code> A function which receives the starting state of the element. The purpose
of this function is to get the element ready for animation. Optionally the function returns an memento which
is passed to the <code>start</code> function.</li>
<li><code>start</code>: <code>function(Element, doneFunction, *)</code> The element to animate, the <code>doneFunction</code> to be called on
element animation completion, and an optional memento from the <code>setup</code> function.</li>
</ul><h4 id="Parameters">Parameters</h4>
<ul class="parameters"><li><code ng:non-bindable="">name {string} </code>
<p>The name of the animation.</p></li>
<li><code ng:non-bindable="">factory {function} </code>
<p>The factory function that will be executed to return the animation object.</p></li>
</ul>
</div>
</li>
</ul>
</div>
</div>

View file

@ -1,69 +0,0 @@
<h1><code ng:non-bindable="">$animator</code>
<span class="hint">(service in module <code ng:non-bindable="">ng</code>
)</span>
</h1>
<div><a href="http://github.com/angular/angular.js/edit/master/src/ng/animator.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p>The $animator service provides the DOM manipulation API which is decorated with animations.</p></div>
<h2 id="Usage">Usage</h2>
<div class="usage"><pre class="prettyprint linenums">$animator(scope, attr);</pre>
<h3 id="Parameters">Parameters</h3>
<ul class="parameters"><li><code ng:non-bindable="">scope {Scope} </code>
<p>the scope for the ng-animate.</p></li>
<li><code ng:non-bindable="">attr {Attributes} </code>
<p>the attributes object which contains the ngAnimate key / value pair. (The attributes are
passed into the linking function of the directive using the <code>$animator</code>.)</p></li>
</ul>
<h3 id="Returns">Returns</h3>
<div class="returns"><code ng:non-bindable="">{object}</code>
<p>the animator object which contains the enter, leave, move, show, hide and animate methods.</p></div>
</div>
<div class="member method"><h2 id="Methods">Methods</h2>
<ul class="methods"><li><h3 id="enter">enter(element, parent, after)</h3>
<div class="enter"><p>Injects the element object into the DOM (inside of the parent element) and then runs the enter animation.</p><h4 id="Parameters">Parameters</h4>
<ul class="parameters"><li><code ng:non-bindable="">element {jQuery/jqLite element} </code>
<p>the element that will be the focus of the enter animation</p></li>
<li><code ng:non-bindable="">parent {jQuery/jqLite element} </code>
<p>the parent element of the element that will be the focus of the enter animation</p></li>
<li><code ng:non-bindable="">after {jQuery/jqLite element} </code>
<p>the sibling element (which is the previous element) of the element that will be the focus of the enter animation</p></li>
</ul>
</div>
</li>
<li><h3 id="hide">hide(element)</h3>
<div class=""><p>Starts the hide animation first and sets the CSS <code>display</code> property to <code>none</code> upon completion.</p><h4 id="Parameters">Parameters</h4>
<ul class="parameters"><li><code ng:non-bindable="">element {jQuery/jqLite element} </code>
<p>the element that will be rendered visible or hidden</p></li>
</ul>
</div>
</li>
<li><h3 id="leave">leave(element, parent)</h3>
<div class="leave"><p>Runs the leave animation operation and, upon completion, removes the element from the DOM.</p><h4 id="Parameters">Parameters</h4>
<ul class="parameters"><li><code ng:non-bindable="">element {jQuery/jqLite element} </code>
<p>the element that will be the focus of the leave animation</p></li>
<li><code ng:non-bindable="">parent {jQuery/jqLite element} </code>
<p>the parent element of the element that will be the focus of the leave animation</p></li>
</ul>
</div>
</li>
<li><h3 id="move">move(element, parent, after)</h3>
<div class="move"><p>Fires the move DOM operation. Just before the animation starts, the animator will either append it into the parent container or
add the element directly after the after element if present. Then the move animation will be run.</p><h4 id="Parameters">Parameters</h4>
<ul class="parameters"><li><code ng:non-bindable="">element {jQuery/jqLite element} </code>
<p>the element that will be the focus of the move animation</p></li>
<li><code ng:non-bindable="">parent {jQuery/jqLite element} </code>
<p>the parent element of the element that will be the focus of the move animation</p></li>
<li><code ng:non-bindable="">after {jQuery/jqLite element} </code>
<p>the sibling element (which is the previous element) of the element that will be the focus of the move animation</p></li>
</ul>
</div>
</li>
<li><h3 id="show">show(element)</h3>
<div class="show"><p>Reveals the element by setting the CSS property <code>display</code> to <code>block</code> and then starts the show animation directly after.</p><h4 id="Parameters">Parameters</h4>
<ul class="parameters"><li><code ng:non-bindable="">element {jQuery/jqLite element} </code>
<p>the element that will be rendered visible or hidden</p></li>
</ul>
</div>
</li>
</ul>
</div>
</div>

56
lib/angular/docs/partials/api/ng.$cacheFactory.html Normal file → Executable file
View file

@ -1,25 +1,31 @@
<h1><code ng:non-bindable="">$cacheFactory</code>
<span class="hint">(service in module <code ng:non-bindable="">ng</code>
)</span>
<a href="http://github.com/angular/angular.js/tree/v1.2.0rc1/src/ng/cacheFactory.js#L1" 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/cacheFactory.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">$cacheFactory</code>
<div><span class="hint">service in module <code ng:non-bindable="">ng</code>
</span>
</div>
</h1>
<div><a href="http://github.com/angular/angular.js/edit/master/src/ng/cacheFactory.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p>Factory that constructs cache objects.</p></div>
<div><h2 id="Description">Description</h2>
<div class="description"><div class="ng-cachefactory-page"><p>Factory that constructs cache objects and gives access to them.</p>
<pre class="prettyprint linenums">
var cache = $cacheFactory('cacheId');
expect($cacheFactory.get('cacheId')).toBe(cache);
expect($cacheFactory.get('noSuchCacheId')).not.toBeDefined();
cache.put("key", "value");
cache.put("another key", "another value");
expect(cache.info()).toEqual({id: 'cacheId', size: 2}); // Since we've specified no options on creation
</pre>
</div></div>
<h2 id="Usage">Usage</h2>
<div class="usage"><pre class="prettyprint linenums">$cacheFactory(cacheId[, options]);</pre>
<h3 id="Parameters">Parameters</h3>
<ul class="parameters"><li><code ng:non-bindable="">cacheId {string} </code>
<p>Name or id of the newly created cache.</p></li>
<li><code ng:non-bindable="">options<i>(optional)</i> {object=} </code>
<p>Options object that specifies the cache behavior. Properties:</p>
<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>cacheId</td><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="ng-cachefactory-page"><p>Name or id of the newly created cache.</p>
</div></td></tr><tr><td>options <div><em>(optional)</em></div></td><td><a href="" class="label type-hint type-hint-object">object</a></td><td><div class="ng-cachefactory-page"><p>Options object that specifies the cache behavior. Properties:</p>
<ul>
<li><code>{number=}</code> <code>capacity</code> — turns the cache into LRU cache.</li>
</ul></li>
</ul>
<h3 id="Returns">Returns</h3>
<div class="returns"><code ng:non-bindable="">{object}</code>
<p>Newly created cache object with the following set of methods:</p>
</div></td></tr></tbody></table><h4 id="returns">Returns</h4><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-object">object</a></td><td><div class="ng-cachefactory-page"><p>Newly created cache object with the following set of methods:</p>
<ul>
<li><code>{object}</code> <code>info()</code> — Returns id, size, and options of cache.</li>
<li><code>{{*}}</code> <code>put({string} key, {*} value)</code> — Puts a new key-value pair into the cache and returns it.</li>
@ -27,6 +33,22 @@
<li><code>{void}</code> <code>remove({string} key)</code> — Removes a key-value pair from the cache.</li>
<li><code>{void}</code> <code>removeAll()</code> — Removes all cached values.</li>
<li><code>{void}</code> <code>destroy()</code> — Removes references to this cache from $cacheFactory.</li>
</ul></div>
</ul>
</div></td></tr></table></div>
<div class="member method"><h2 id="Methods">Methods</h2>
<ul class="methods"><li><h3 id="get">get(cacheId)</h3>
<div class="get"><div class="ng-cachefactory-get-page"><p>Get access to a cache object by the <code>cacheId</code> used when it was created.</p>
</div><h5 id="parameters">Parameters</h5><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>cacheId</td><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="ng-cachefactory-get-page"><p>Name or id of a cache to access.</p>
</div></td></tr></tbody></table><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-object">object</a></td><td><div class="ng-cachefactory-get-page"><p>Cache object identified by the cacheId or undefined if no such cache.</p>
</div></td></tr></table></div>
</li>
<li><h3 id="info">info()</h3>
<div class="info"><div class="ng-cachefactory-info-page"><p>Get information about all the of the caches that have been created</p>
</div><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-object">Object</a></td><td><div class="ng-cachefactory-info-page"><ul>
<li>key-value map of <code>cacheId</code> to the result of calling <code>cache#info</code></li>
</ul>
</div></td></tr></table></div>
</li>
</ul>
</div>
</div>

View file

@ -1,35 +1,42 @@
<h1><code ng:non-bindable="">Attributes</code>
<span class="hint">(type in module <code ng:non-bindable="">ng</code>
)</span>
<a href="http://github.com/angular/angular.js/tree/v1.2.0rc1/src/ng/compile.js#L1394" 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/compile.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">Attributes</code>
<div><span class="hint">type in module <code ng:non-bindable="">ng</code>
</span>
</div>
</h1>
<div><a href="http://github.com/angular/angular.js/edit/master/src/ng/compile.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p>A shared object between directive compile / linking functions which contains normalized DOM element
<div><h2 id="Description">Description</h2>
<div class="description"><div class="ng-compile-directive-attributes-page"><p>A shared object between directive compile / linking functions which contains normalized DOM element
attributes. The the values reflect current binding state <code>{{ }}</code>. The normalization is needed
since all of these are treated as equivalent in Angular:</p>
<pre><code> &lt;span ng:bind="a" ng-bind="a" data-ng-bind="a" x-ng-bind="a"&gt;
</code></pre></div>
<pre><code> &lt;span ng:bind=&quot;a&quot; ng-bind=&quot;a&quot; data-ng-bind=&quot;a&quot; x-ng-bind=&quot;a&quot;&gt;</code></pre>
</div></div>
<div class="member method"><h2 id="Methods">Methods</h2>
<ul class="methods"><li><h3 id="$set">$set(name, value)</h3>
<div class="$set"><p>Set DOM element attribute value.</p><h4 id="Parameters">Parameters</h4>
<ul class="parameters"><li><code ng:non-bindable="">name {string} </code>
<p>Normalized element attribute name of the property to modify. The name is
<ul class="methods"><li><h3 id="$addClass">$addClass(classVal)</h3>
<div class="$addclass"><div class="ng-compile-directive-attributes-addclass-page"><p>Adds the CSS class value specified by the classVal parameter to the element. If animations
are enabled then an animation will be triggered for the class addition.</p>
</div><h5 id="parameters">Parameters</h5><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>classVal</td><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="ng-compile-directive-attributes-addclass-page"><p>The className value that will be added to the element</p>
</div></td></tr></tbody></table></div>
</li>
<li><h3 id="$removeClass">$removeClass(classVal)</h3>
<div class="$removeclass"><div class="ng-compile-directive-attributes-removeclass-page"><p>Removes the CSS class value specified by the classVal parameter from the element. If animations
are enabled then an animation will be triggered for the class removal.</p>
</div><h5 id="parameters">Parameters</h5><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>classVal</td><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="ng-compile-directive-attributes-removeclass-page"><p>The className value that will be removed from the element</p>
</div></td></tr></tbody></table></div>
</li>
<li><h3 id="$set">$set(name, value)</h3>
<div class="$set"><div class="ng-compile-directive-attributes-set-page"><p>Set DOM element attribute value.</p>
</div><h5 id="parameters">Parameters</h5><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>name</td><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="ng-compile-directive-attributes-set-page"><p>Normalized element attribute name of the property to modify. The name is
revers translated using the <a href="api/ng.$compile.directive.Attributes#$attr"><code>$attr</code></a>
property to the original name.</p></li>
<li><code ng:non-bindable="">value {string} </code>
<p>Value to set the attribute to. The value can be an interpolated string.</p></li>
</ul>
</div>
property to the original name.</p>
</div></td></tr><tr><td>value</td><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="ng-compile-directive-attributes-set-page"><p>Value to set the attribute to. The value can be an interpolated string.</p>
</div></td></tr></tbody></table></div>
</li>
</ul>
</div>
<div class="member property"><h2 id="Properties">Properties</h2>
<ul class="properties"><li><h3 id="$attr">$attr</h3>
<div class="$attr"><h4 id="Returns">Returns</h4>
<div class="returns"><code ng:non-bindable="">{object}</code>
<p>A map of DOM element attribute names to the normalized name. This is
needed to do reverse lookup from normalized name back to actual name.</p></div>
</div>
<div class="$attr"><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-object">object</a></td><td><div class="ng-compile-directive-attributes-attr-page"><p>A map of DOM element attribute names to the normalized name. This is
needed to do reverse lookup from normalized name back to actual name.</p>
</div></td></tr></table></div>
</li>
</ul>
</div>

84
lib/angular/docs/partials/api/ng.$compile.html Normal file → Executable file
View file

@ -1,25 +1,23 @@
<h1><code ng:non-bindable="">$compile</code>
<span class="hint">(service in module <code ng:non-bindable="">ng</code>
)</span>
<a href="http://github.com/angular/angular.js/tree/v1.2.0rc1/src/ng/compile.js#L21" 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/compile.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">$compile</code>
<div><span class="hint">service in module <code ng:non-bindable="">ng</code>
</span>
</div>
</h1>
<div><a href="http://github.com/angular/angular.js/edit/master/src/ng/compile.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p>Compiles a piece of HTML string or DOM into a template and produces a template function, which
<div><h2 id="Description">Description</h2>
<div class="description"><div class="ng-compile-page"><p>Compiles a piece of HTML string or DOM into a template and produces a template function, which
can then be used to link <a href="api/ng.$rootScope.Scope"><code>scope</code></a> and the template together.</p>
<p>The compilation is a process of walking the DOM tree and trying to match DOM elements to
<a href="api/ng.$compileProvider#directive"><code>directives</code></a>. For each match it
executes corresponding template function and collects the
instance functions into a single template function which is then returned.</p>
<p>The template function can then be used once to produce the view or as it is the case with
<a href="api/ng.directive:ngRepeat"><code>repeater</code></a> many-times, in which
case each call results in a view that is a DOM clone of the original template.</p>
<h4>Source</h4>
<div source-edit="compile" source-edit-deps="angular.js script.js" source-edit-html="index.html-84" source-edit-css="" source-edit-js="script.js-83" source-edit-unit="" source-edit-scenario="scenario.js-85"></div>
<p> <h4>Source</h2>
<div source-edit="compile" source-edit-deps="angular.js script.js" source-edit-html="index.html-0" source-edit-css="" source-edit-js="script.js" source-edit-json="" source-edit-unit="" source-edit-scenario="scenario.js"></div>
<div class="tabbable"><div class="tab-pane" title="index.html">
<pre class="prettyprint linenums" ng-set-text="index.html-84" ng-html-wrap="compile angular.js script.js"></pre>
<script type="text/ng-template" id="index.html-84">
<pre class="prettyprint linenums" ng-set-text="index.html-0" ng-html-wrap="compile angular.js script.js"></pre>
<script type="text/ng-template" id="index.html-0">
<div ng-controller="Ctrl">
<input ng-model="name"> <br>
@ -29,8 +27,8 @@ case each call results in a view that is a DOM clone of the original template.</
</script>
</div>
<div class="tab-pane" title="script.js">
<pre class="prettyprint linenums" ng-set-text="script.js-83"></pre>
<script type="text/ng-template" id="script.js-83">
<pre class="prettyprint linenums" ng-set-text="script.js"></pre>
<script type="text/ng-template" id="script.js">
// declare a new module, and inject the $compileProvider
angular.module('compile', [], function($compileProvider) {
// configure new 'compile' directive by passing a directive
@ -66,8 +64,8 @@ case each call results in a view that is a DOM clone of the original template.</
</script>
</div>
<div class="tab-pane" title="End to end test">
<pre class="prettyprint linenums" ng-set-text="scenario.js-85"></pre>
<script type="text/ng-template" id="scenario.js-85">
<pre class="prettyprint linenums" ng-set-text="scenario.js"></pre>
<script type="text/ng-template" id="scenario.js">
it('should auto compile', function() {
expect(element('div[compile]').text()).toBe('Hello Angular');
input('html').enter('{{name}}!');
@ -75,49 +73,41 @@ case each call results in a view that is a DOM clone of the original template.</
});
</script>
</div>
</div><h4>Demo</h4>
<div class="well doc-example-live animator-container" ng-embed-app="compile" ng-set-html="index.html-84" ng-eval-javascript="script.js-83"></div></div>
</div><h2>Demo</h4>
<div class="well doc-example-live animate-container" ng-embed-app="compile" ng-set-html="index.html-0" ng-eval-javascript="script.js"></div>
</div></div>
<h2 id="Usage">Usage</h2>
<div class="usage"><pre class="prettyprint linenums">$compile(element, transclude, maxPriority);</pre>
<h3 id="Parameters">Parameters</h3>
<ul class="parameters"><li><code ng:non-bindable="">element {string|DOMElement} </code>
<p>Element or HTML string to compile into a template function.</p></li>
<li><code ng:non-bindable="">transclude {function(angular.Scope[, cloneAttachFn]} </code>
<p>function available to directives.</p></li>
<li><code ng:non-bindable="">maxPriority {number} </code>
<p>only apply directives lower then given priority (Only effects the
root element(s), not their children)</p></li>
</ul>
<h3 id="Returns">Returns</h3>
<div class="returns"><code ng:non-bindable="">{function(scope[, cloneAttachFn])}</code>
<p>a link function which is used to bind template
<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>element</td><td><a href="" class="label type-hint type-hint-string">string</a><a href="" class="label type-hint type-hint-domelement">DOMElement</a></td><td><div class="ng-compile-page"><p>Element or HTML string to compile into a template function.</p>
</div></td></tr><tr><td>transclude</td><td><a href="" class="label type-hint type-hint-function">function(angular.Scope[, cloneAttachFn]</a></td><td><div class="ng-compile-page"><p>function available to directives.</p>
</div></td></tr><tr><td>maxPriority</td><td><a href="" class="label type-hint type-hint-number">number</a></td><td><div class="ng-compile-page"><p>only apply directives lower then given priority (Only effects the
root element(s), not their children)</p>
</div></td></tr></tbody></table><h4 id="returns">Returns</h4><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-function">function(scope[, cloneAttachFn])</a></td><td><div class="ng-compile-page"><p>a link function which is used to bind template
(a DOM element/tree) to a scope. Where:</p>
<ul>
<li><code>scope</code> - A <a href="api/ng.$rootScope.Scope"><code>Scope</code></a> to bind to.</li>
<li><p><code>cloneAttachFn</code> - If <code>cloneAttachFn</code> is provided, then the link function will clone the
<code>template</code> and call the <code>cloneAttachFn</code> function allowing the caller to attach the
cloned elements to the DOM document at the appropriate place. The <code>cloneAttachFn</code> is
called as: <br> <code>cloneAttachFn(clonedElement, scope)</code> where:</p>
<ul><li><code>clonedElement</code> - is a clone of the original <code>element</code> passed into the compiler.</li>
<li><code>scope</code> - is the current scope with which the linking function is working with.</li></ul></li>
<li><p><code>cloneAttachFn</code> - If <code>cloneAttachFn</code> is provided, then the link function will clone the</p>
<pre><code> `template` and call the `cloneAttachFn` function allowing the caller to attach the
cloned elements to the DOM document at the appropriate place. The `cloneAttachFn` is
called as: &lt;br&gt; `cloneAttachFn(clonedElement, scope)` where:</code></pre>
<ul>
<li><code>clonedElement</code> - is a clone of the original <code>element</code> passed into the compiler.</li>
<li><code>scope</code> - is the current scope with which the linking function is working with.</li>
</ul>
</li>
</ul>
<p>Calling the linking function returns the element of the template. It is either the original element
passed in, or the clone of the element if the <code>cloneAttachFn</code> is provided.</p>
<p>After linking the view is not updated until after a call to $digest which typically is done by
Angular automatically.</p>
<p>If you need access to the bound view, there are two ways to do it:</p>
<ul>
<li><p>If you are not asking the linking function to clone the template, create the DOM element(s)
before you send them to the compiler and keep this reference around.
<pre class="prettyprint linenums">
var element = $compile('&lt;p&gt;{{total}}&lt;/p&gt;')(scope);
</pre></li>
</pre>
</li>
<li><p>if on the other hand, you need the element to be cloned, the view reference from the original
example would not point to the clone, but rather to the original template that was cloned. In
this case, you can access the clone via the cloneAttachFn:
@ -130,10 +120,10 @@ this case, you can access the clone via the cloneAttachFn:
});
//now we have reference to the cloned DOM via `clone`
</pre></li>
</pre>
</li>
</ul>
<p>For information on how the compiler works, see the
<a href="guide/compiler">Angular HTML Compiler</a> section of the Developer Guide.</p></div>
</div>
<a href="guide/compiler">Angular HTML Compiler</a> section of the Developer Guide.</p>
</div></td></tr></table></div>
</div>

71
lib/angular/docs/partials/api/ng.$compileProvider.html Normal file → Executable file
View file

@ -1,42 +1,45 @@
<h1><code ng:non-bindable="">$compileProvider</code>
<span class="hint">(service in module <code ng:non-bindable="">ng</code>
)</span>
<a href="http://github.com/angular/angular.js/tree/v1.2.0rc1/src/ng/compile.js#L143" 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/compile.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">$compileProvider</code>
<div><span class="hint">service in module <code ng:non-bindable="">ng</code>
</span>
</div>
</h1>
<div><a href="http://github.com/angular/angular.js/edit/master/src/ng/compile.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div><h2 id="Description">Description</h2>
<div class="description"></div>
<div class="member method"><h2 id="Methods">Methods</h2>
<ul class="methods"><li><h3 id="directive">directive(name, directiveFactory)</h3>
<div class="directive"><p>Register a new directives with the compiler.</p><h4 id="Parameters">Parameters</h4>
<ul class="parameters"><li><code ng:non-bindable="">name {string} </code>
<p>Name of the directive in camel-case. (ie <code>ngBind</code> which will match as
<code>ng-bind</code>).</p></li>
<li><code ng:non-bindable="">directiveFactory {function} </code>
<p>An injectable directive factory function. See <a href="guide/directive">guide/directive</a> for more
info.</p></li>
</ul>
<h4 id="Returns">Returns</h4>
<div class="returns"><code ng:non-bindable="">{ng.$compileProvider}</code>
<p>Self for chaining.</p></div>
</div>
</li>
<li><h3 id="urlSanitizationWhitelist">urlSanitizationWhitelist(regexp)</h3>
<div class="urlsanitizationwhitelist"><p>Retrieves or overrides the default regular expression that is used for whitelisting of safe
<ul class="methods"><li><h3 id="aHrefSanitizationWhitelist">aHrefSanitizationWhitelist(regexp)</h3>
<div class="ahrefsanitizationwhitelist"><div class="ng-compileprovider-ahrefsanitizationwhitelist-page"><p>Retrieves or overrides the default regular expression that is used for whitelisting of safe
urls during a[href] sanitization.</p>
<p>The sanitization is a security measure aimed at prevent XSS attacks via html links.</p>
<p>Any url about to be assigned to a[href] via data-binding is first normalized and turned into an
absolute url. Afterwards the url is matched against the <code>urlSanitizationWhitelist</code> regular
expression. If a match is found the original url is written into the dom. Otherwise the
absolute url is prefixed with <code>'unsafe:'</code> string and only then it is written into the DOM.</p><h4 id="Parameters">Parameters</h4>
<ul class="parameters"><li><code ng:non-bindable="">regexp<i>(optional)</i> {RegExp=} </code>
<p>New regexp to whitelist urls with.</p></li>
</ul>
<h4 id="Returns">Returns</h4>
<div class="returns"><code ng:non-bindable="">{RegExp|ng.$compileProvider}</code>
<p>Current RegExp if called without value or self for
chaining otherwise.</p></div>
</div>
<p>Any url about to be assigned to a[href] via data-binding is first normalized and turned into
an absolute url. Afterwards, the url is matched against the <code>aHrefSanitizationWhitelist</code>
regular expression. If a match is found, the original url is written into the dom. Otherwise,
the absolute url is prefixed with <code>&#39;unsafe:&#39;</code> string and only then is it written into the DOM.</p>
</div><h5 id="parameters">Parameters</h5><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>regexp <div><em>(optional)</em></div></td><td><a href="" class="label type-hint type-hint-regexp">RegExp</a></td><td><div class="ng-compileprovider-ahrefsanitizationwhitelist-page"><p>New regexp to whitelist urls with.</p>
</div></td></tr></tbody></table><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-regexp">RegExp|ng.$compileProvider</a></td><td><div class="ng-compileprovider-ahrefsanitizationwhitelist-page"><p>Current RegExp if called without value or self for
chaining otherwise.</p>
</div></td></tr></table></div>
</li>
<li><h3 id="directive">directive(name, directiveFactory)</h3>
<div class="directive"><div class="ng-compileprovider-directive-page"><p>Register a new directive with the compiler.</p>
</div><h5 id="parameters">Parameters</h5><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>name</td><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="ng-compileprovider-directive-page"><p>Name of the directive in camel-case. (ie <code>ngBind</code> which will match as
<code>ng-bind</code>).</p>
</div></td></tr><tr><td>directiveFactory</td><td><a href="" class="label type-hint type-hint-function">function</a><a href="" class="label type-hint type-hint-array">Array</a></td><td><div class="ng-compileprovider-directive-page"><p>An injectable directive factory function. See <a href="guide/directive">guide/directive</a> for more
info.</p>
</div></td></tr></tbody></table><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-ng">ng.$compileProvider</a></td><td><div class="ng-compileprovider-directive-page"><p>Self for chaining.</p>
</div></td></tr></table></div>
</li>
<li><h3 id="imgSrcSanitizationWhitelist">imgSrcSanitizationWhitelist(regexp)</h3>
<div class="imgsrcsanitizationwhitelist"><div class="ng-compileprovider-imgsrcsanitizationwhitelist-page"><p>Retrieves or overrides the default regular expression that is used for whitelisting of safe
urls during img[src] sanitization.</p>
<p>The sanitization is a security measure aimed at prevent XSS attacks via html links.</p>
<p>Any url about to be assigned to img[src] via data-binding is first normalized and turned into an
absolute url. Afterwards, the url is matched against the <code>imgSrcSanitizationWhitelist</code> regular
expression. If a match is found, the original url is written into the dom. Otherwise, the
absolute url is prefixed with <code>&#39;unsafe:&#39;</code> string and only then is it written into the DOM.</p>
</div><h5 id="parameters">Parameters</h5><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>regexp <div><em>(optional)</em></div></td><td><a href="" class="label type-hint type-hint-regexp">RegExp</a></td><td><div class="ng-compileprovider-imgsrcsanitizationwhitelist-page"><p>New regexp to whitelist urls with.</p>
</div></td></tr></tbody></table><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-regexp">RegExp|ng.$compileProvider</a></td><td><div class="ng-compileprovider-imgsrcsanitizationwhitelist-page"><p>Current RegExp if called without value or self for
chaining otherwise.</p>
</div></td></tr></table></div>
</li>
</ul>
</div>

34
lib/angular/docs/partials/api/ng.$controller.html Normal file → Executable file
View file

@ -1,34 +1,28 @@
<h1><code ng:non-bindable="">$controller</code>
<span class="hint">(service in module <code ng:non-bindable="">ng</code>
)</span>
<a href="http://github.com/angular/angular.js/tree/v1.2.0rc1/src/ng/controller.js#L37" 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/controller.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">$controller</code>
<div><span class="hint">service in module <code ng:non-bindable="">ng</code>
</span>
</div>
</h1>
<div><a href="http://github.com/angular/angular.js/edit/master/src/ng/controller.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p><code>$controller</code> service is responsible for instantiating controllers.</p>
<p>It's just a simple call to <a href="api/AUTO.$injector"><code>$injector</code></a>, but extracted into
a service, so that one can override this service with <a href="https://gist.github.com/1649788">BC version</a>.</p></div>
<div><h2 id="Description">Description</h2>
<div class="description"><div class="ng-controller-page"><p><code>$controller</code> service is responsible for instantiating controllers.</p>
<p>It&#39;s just a simple call to <a href="api/AUTO.$injector"><code>$injector</code></a>, but extracted into
a service, so that one can override this service with <a href="https://gist.github.com/1649788">BC version</a>.</p>
</div></div>
<h2 id="Dependencies">Dependencies</h2>
<ul class="dependencies"><li><code ng:non-bindable=""><a href="api/ng.$injector">$injector</a></code>
</li>
</ul>
<h2 id="Usage">Usage</h2>
<div class="usage"><pre class="prettyprint linenums">$controller(constructor, locals);</pre>
<h3 id="Parameters">Parameters</h3>
<ul class="parameters"><li><code ng:non-bindable="">constructor {Function|string} </code>
<p>If called with a function then it's considered to be the
controller constructor function. Otherwise it's considered to be a string which is used
<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>constructor</td><td><a href="" class="label type-hint type-hint-function">Function</a><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="ng-controller-page"><p>If called with a function then it&#39;s considered to be the
controller constructor function. Otherwise it&#39;s considered to be a string which is used
to retrieve the controller constructor using the following steps:</p>
<ul>
<li>check if a controller with given name is registered via <code>$controllerProvider</code></li>
<li>check if evaluating the string on the current scope returns a constructor</li>
<li>check <code>window[constructor]</code> on the global <code>window</code> object</li>
</ul></li>
<li><code ng:non-bindable="">locals {Object} </code>
<p>Injection locals for Controller.</p></li>
</ul>
<h3 id="Returns">Returns</h3>
<div class="returns"><code ng:non-bindable="">{Object}</code>
<p>Instance of given controller.</p></div>
</div>
</div></td></tr><tr><td>locals</td><td><a href="" class="label type-hint type-hint-object">Object</a></td><td><div class="ng-controller-page"><p>Injection locals for Controller.</p>
</div></td></tr></tbody></table><h4 id="returns">Returns</h4><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-object">Object</a></td><td><div class="ng-controller-page"><p>Instance of given controller.</p>
</div></td></tr></table></div>
</div>

View file

@ -1,23 +1,20 @@
<h1><code ng:non-bindable="">$controllerProvider</code>
<span class="hint">(service in module <code ng:non-bindable="">ng</code>
)</span>
<a href="http://github.com/angular/angular.js/tree/v1.2.0rc1/src/ng/controller.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/controller.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">$controllerProvider</code>
<div><span class="hint">service in module <code ng:non-bindable="">ng</code>
</span>
</div>
</h1>
<div><a href="http://github.com/angular/angular.js/edit/master/src/ng/controller.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p>The <a href="api/ng.$controller"><code>$controller service</code></a> is used by Angular to create new
<div><h2 id="Description">Description</h2>
<div class="description"><div class="ng-controllerprovider-page"><p>The <a href="api/ng.$controller"><code>$controller service</code></a> is used by Angular to create new
controllers.</p>
<p>This provider allows controller registration via the
<a href="api/ng.$controllerProvider#register"><code>register</code></a> method.</p></div>
<a href="api/ng.$controllerProvider#register"><code>register</code></a> method.</p>
</div></div>
<div class="member method"><h2 id="Methods">Methods</h2>
<ul class="methods"><li><h3 id="register">register(name, constructor)</h3>
<div class="register"><h4 id="Parameters">Parameters</h4>
<ul class="parameters"><li><code ng:non-bindable="">name {string} </code>
<p>Controller name</p></li>
<li><code ng:non-bindable="">constructor {Function|Array} </code>
<p>Controller constructor fn (optionally decorated with DI
annotations in the array notation).</p></li>
</ul>
</div>
<div class="register"><h5 id="parameters">Parameters</h5><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>name</td><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="ng-controllerprovider-register-page"><p>Controller name</p>
</div></td></tr><tr><td>constructor</td><td><a href="" class="label type-hint type-hint-function">Function</a><a href="" class="label type-hint type-hint-array">Array</a></td><td><div class="ng-controllerprovider-register-page"><p>Controller constructor fn (optionally decorated with DI
annotations in the array notation).</p>
</div></td></tr></tbody></table></div>
</li>
</ul>
</div>

14
lib/angular/docs/partials/api/ng.$document.html Normal file → Executable file
View file

@ -1,10 +1,12 @@
<h1><code ng:non-bindable="">$document</code>
<span class="hint">(service in module <code ng:non-bindable="">ng</code>
)</span>
<a href="http://github.com/angular/angular.js/tree/v1.2.0rc1/src/ng/document.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/document.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">$document</code>
<div><span class="hint">service in module <code ng:non-bindable="">ng</code>
</span>
</div>
</h1>
<div><a href="http://github.com/angular/angular.js/edit/master/src/ng/document.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p>A <a href="api/angular.element"><code>jQuery (lite)</code></a>-wrapped reference to the browser's <code>window.document</code>
element.</p></div>
<div><h2 id="Description">Description</h2>
<div class="description"><div class="ng-document-page"><p>A <a href="api/angular.element"><code>jQuery (lite)</code></a>-wrapped reference to the browser&#39;s <code>window.document</code>
element.</p>
</div></div>
<h2 id="Dependencies">Dependencies</h2>
<ul class="dependencies"><li><code ng:non-bindable=""><a href="api/ng.$window">$window</a></code>
</li>

27
lib/angular/docs/partials/api/ng.$exceptionHandler.html Normal file → Executable file
View file

@ -1,26 +1,23 @@
<h1><code ng:non-bindable="">$exceptionHandler</code>
<span class="hint">(service in module <code ng:non-bindable="">ng</code>
)</span>
<a href="http://github.com/angular/angular.js/tree/v1.2.0rc1/src/ng/exceptionHandler.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/exceptionHandler.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">$exceptionHandler</code>
<div><span class="hint">service in module <code ng:non-bindable="">ng</code>
</span>
</div>
</h1>
<div><a href="http://github.com/angular/angular.js/edit/master/src/ng/exceptionHandler.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p>Any uncaught exception in angular expressions is delegated to this service.
<div><h2 id="Description">Description</h2>
<div class="description"><div class="ng-exceptionhandler-page"><p>Any uncaught exception in angular expressions is delegated to this service.
The default implementation simply delegates to <code>$log.error</code> which logs it into
the browser console.</p>
<p>In unit tests, if <code>angular-mocks.js</code> is loaded, this service is overridden by
<a href="api/ngMock.$exceptionHandler">mock $exceptionHandler</a> which aids in testing.</p></div>
<a href="api/ngMock.$exceptionHandler">mock $exceptionHandler</a> which aids in testing.</p>
</div></div>
<h2 id="Dependencies">Dependencies</h2>
<ul class="dependencies"><li><code ng:non-bindable=""><a href="api/ng.$log">$log</a></code>
</li>
</ul>
<h2 id="Usage">Usage</h2>
<div class="usage"><pre class="prettyprint linenums">$exceptionHandler(exception[, cause]);</pre>
<h3 id="Parameters">Parameters</h3>
<ul class="parameters"><li><code ng:non-bindable="">exception {Error} </code>
<p>Exception associated with the error.</p></li>
<li><code ng:non-bindable="">cause<i>(optional)</i> {string=} </code>
<p>optional information about the context in which
the error was thrown.</p></li>
</ul>
</div>
<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>exception</td><td><a href="" class="label type-hint type-hint-error">Error</a></td><td><div class="ng-exceptionhandler-page"><p>Exception associated with the error.</p>
</div></td></tr><tr><td>cause <div><em>(optional)</em></div></td><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="ng-exceptionhandler-page"><p>optional information about the context in which
the error was thrown.</p>
</div></td></tr></tbody></table></div>
</div>

28
lib/angular/docs/partials/api/ng.$filter.html Normal file → Executable file
View file

@ -1,22 +1,16 @@
<h1><code ng:non-bindable="">$filter</code>
<span class="hint">(service in module <code ng:non-bindable="">ng</code>
)</span>
<a href="http://github.com/angular/angular.js/tree/v1.2.0rc1/src/ng/filter.js#L63" 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/filter.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">$filter</code>
<div><span class="hint">service in module <code ng:non-bindable="">ng</code>
</span>
</div>
</h1>
<div><a href="http://github.com/angular/angular.js/edit/master/src/ng/filter.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p>Filters are used for formatting data displayed to the user.</p>
<div><h2 id="Description">Description</h2>
<div class="description"><div class="ng-filter-page"><p>Filters are used for formatting data displayed to the user.</p>
<p>The general syntax in templates is as follows:</p>
<pre><code> {{ expression | [ filter_name ] }}
</code></pre></div>
<pre><code> {{ expression [| filter_name[:parameter_value] ... ] }}</code></pre>
</div></div>
<h2 id="Usage">Usage</h2>
<div class="usage"><pre class="prettyprint linenums">$filter(name);</pre>
<h3 id="Parameters">Parameters</h3>
<ul class="parameters"><li><code ng:non-bindable="">name {String} </code>
<p>Name of the filter function to retrieve</p></li>
</ul>
<h3 id="Returns">Returns</h3>
<div class="returns"><code ng:non-bindable="">{Function}</code>
<p>the filter function</p></div>
</div>
<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>name</td><td><a href="" class="label type-hint type-hint-string">String</a></td><td><div class="ng-filter-page"><p>Name of the filter function to retrieve</p>
</div></td></tr></tbody></table><h4 id="returns">Returns</h4><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-function">Function</a></td><td><div class="ng-filter-page"><p>the filter function</p>
</div></td></tr></table></div>
</div>

30
lib/angular/docs/partials/api/ng.$filterProvider.html Normal file → Executable file
View file

@ -1,12 +1,12 @@
<h1><code ng:non-bindable="">$filterProvider</code>
<span class="hint">(service in module <code ng:non-bindable="">ng</code>
)</span>
<a href="http://github.com/angular/angular.js/tree/v1.2.0rc1/src/ng/filter.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/filter.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">$filterProvider</code>
<div><span class="hint">service in module <code ng:non-bindable="">ng</code>
</span>
</div>
</h1>
<div><a href="http://github.com/angular/angular.js/edit/master/src/ng/filter.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p>Filters are just functions which transform input to an output. However filters need to be Dependency Injected. To
<div><h2 id="Description">Description</h2>
<div class="description"><div class="ng-filterprovider-page"><p>Filters are just functions which transform input to an output. However filters need to be Dependency Injected. To
achieve this a filter definition consists of a factory function which is annotated with dependencies and is
responsible for creating a filter function.</p>
<pre class="prettyprint linenums">
// Filter registration
function MyModule($provide, $filterProvider) {
@ -27,8 +27,7 @@ responsible for creating a filter function.</p>
});
}
</pre>
<p>The filter function is registered with the <code>$injector</code> under the filter name suffixe with <code>Filter</code>.
<p>The filter function is registered with the <code>$injector</code> under the filter name suffix with <code>Filter</code>.
<pre class="prettyprint linenums">
it('should be the same instance', inject(
function($filterProvider) {
@ -40,19 +39,16 @@ responsible for creating a filter function.</p>
expect($filter('reverse')).toBe(reverseFilter);
});
</pre>
<p>For more information about how angular filters work, and how to create your own filters, see
<a href="guide/dev_guide.templates.filters">Understanding Angular Filters</a> in the angular Developer
Guide.</p></div>
Guide.</p>
</div></div>
<div class="member method"><h2 id="Methods">Methods</h2>
<ul class="methods"><li><h3 id="register">register(name, fn)</h3>
<div class="register"><p>Register filter factory function.</p><h4 id="Parameters">Parameters</h4>
<ul class="parameters"><li><code ng:non-bindable="">name {String} </code>
<p>Name of the filter.</p></li>
<li><code ng:non-bindable="">fn {function} </code>
<p>The filter factory function which is injectable.</p></li>
</ul>
</div>
<div class="register"><div class="ng-filterprovider-register-page"><p>Register filter factory function.</p>
</div><h5 id="parameters">Parameters</h5><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>name</td><td><a href="" class="label type-hint type-hint-string">String</a></td><td><div class="ng-filterprovider-register-page"><p>Name of the filter.</p>
</div></td></tr><tr><td>fn</td><td><a href="" class="label type-hint type-hint-function">function</a></td><td><div class="ng-filterprovider-register-page"><p>The filter factory function which is injectable.</p>
</div></td></tr></tbody></table></div>
</li>
</ul>
</div>

342
lib/angular/docs/partials/api/ng.$http.html Normal file → Executable file
View file

@ -1,26 +1,21 @@
<h1><code ng:non-bindable="">$http</code>
<span class="hint">(service in module <code ng:non-bindable="">ng</code>
)</span>
<a href="http://github.com/angular/angular.js/tree/v1.2.0rc1/src/ng/http.js#L172" 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/http.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">$http</code>
<div><span class="hint">service in module <code ng:non-bindable="">ng</code>
</span>
</div>
</h1>
<div><a href="http://github.com/angular/angular.js/edit/master/src/ng/http.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p>The <code>$http</code> service is a core Angular service that facilitates communication with the remote
HTTP servers via browser's <a href="https://developer.mozilla.org/en/xmlhttprequest">XMLHttpRequest</a> object or via <a href="http://en.wikipedia.org/wiki/JSONP">JSONP</a>.</p>
<div><h2 id="Description">Description</h2>
<div class="description"><div class="ng-http-page"><p>The <code>$http</code> service is a core Angular service that facilitates communication with the remote
HTTP servers via the browser&#39;s <a href="https://developer.mozilla.org/en/xmlhttprequest">XMLHttpRequest</a> object or via <a href="http://en.wikipedia.org/wiki/JSONP">JSONP</a>.</p>
<p>For unit testing applications that use <code>$http</code> service, see
<a href="api/ngMock.$httpBackend">$httpBackend mock</a>.</p>
<p>For a higher level of abstraction, please check out the <a href="api/ngResource.$resource">$resource</a> service.</p>
<a href="../../../../../index.html.$httpBackend">$httpBackend mock</a>.</p>
<p>For a higher level of abstraction, please check out the <a href="../../../../../index.htmlurce.$resource">$resource</a> service.</p>
<p>The $http API is based on the <a href="api/ng.$q"><code>deferred/promise APIs</code></a> exposed by
the $q service. While for simple usage patters this doesn't matter much, for advanced usage,
it is important to familiarize yourself with these apis and guarantees they provide.</p>
<h3>General usage</h3>
the $q service. While for simple usage patterns this doesn&#39;t matter much, for advanced usage
it is important to familiarize yourself with these APIs and the guarantees they provide.</p>
<h3>General usage</h1>
<p>The <code>$http</code> service is a function which takes a single argument — a configuration object —
that is used to generate an http request and returns a <a href="api/ng.$q"><code>promise</code></a>
that is used to generate an HTTP request and returns a <a href="api/ng.$q"><code>promise</code></a>
with two $http specific methods: <code>success</code> and <code>error</code>.</p>
<pre class="prettyprint linenums">
$http({method: 'GET', url: '/someUrl'}).
success(function(data, status, headers, config) {
@ -32,30 +27,23 @@ with two $http specific methods: <code>success</code> and <code>error</code>.</p
// or server returns response with an error status.
});
</pre>
<p>Since the returned value of calling the $http function is a Promise object, you can also use
<p>Since the returned value of calling the $http function is a <code>promise</code>, you can also use
the <code>then</code> method to register callbacks, and these callbacks will receive a single argument
an object representing the response. See the api signature and type info below for more
an object representing the response. See the API signature and type info below for more
details.</p>
<p>A response status code that falls in the [200, 300) range is considered a success status and
<p>A response status code between 200 and 299 is considered a success status and
will result in the success callback being called. Note that if the response is a redirect,
XMLHttpRequest will transparently follow it, meaning that the error callback will not be
called for such responses.</p>
<h3>Shortcut methods</h3>
<p>Since all invocation of the $http service require definition of the http method and url and
POST and PUT requests require response body/data to be provided as well, shortcut methods
were created to simplify using the api:</p>
<h1>Shortcut methods</h1>
<p>Since all invocations of the $http service require passing in an HTTP method and URL, and
POST/PUT requests require request data to be provided as well, shortcut methods
were created:</p>
<pre class="prettyprint linenums">
$http.get('/someUrl').success(successCallback);
$http.post('/someUrl', data).success(successCallback);
</pre>
<p>Complete list of shortcut methods:</p>
<ul>
<li><a href="api/ng.$http#get"><code>$http.get</code></a></li>
<li><a href="api/ng.$http#head"><code>$http.head</code></a></li>
@ -64,91 +52,73 @@ were created to simplify using the api:</p>
<li><a href="api/ng.$http#delete"><code>$http.delete</code></a></li>
<li><a href="api/ng.$http#jsonp"><code>$http.jsonp</code></a></li>
</ul>
<h3>Setting HTTP Headers</h3>
<p>The $http service will automatically add certain http headers to all requests. These defaults
<h1>Setting HTTP Headers</h1>
<p>The $http service will automatically add certain HTTP headers to all requests. These defaults
can be fully configured by accessing the <code>$httpProvider.defaults.headers</code> configuration
object, which currently contains this default configuration:</p>
<ul>
<li><code>$httpProvider.defaults.headers.common</code> (headers that are common for all requests):
<ul><li><code>Accept: application/json, text/plain, * / *</code></li></ul></li>
<li><code>$httpProvider.defaults.headers.post</code>: (header defaults for HTTP POST requests)
<ul><li><code>Content-Type: application/json</code></li></ul></li>
<li><code>$httpProvider.defaults.headers.put</code> (header defaults for HTTP PUT requests)
<ul><li><code>Content-Type: application/json</code></li></ul></li>
<li><code>$httpProvider.defaults.headers.common</code> (headers that are common for all requests):<ul>
<li><code>Accept: application/json, text/plain, * / *</code></li>
</ul>
<p>To add or overwrite these defaults, simply add or remove a property from this configuration
</li>
<li><code>$httpProvider.defaults.headers.post</code>: (header defaults for POST requests)<ul>
<li><code>Content-Type: application/json</code></li>
</ul>
</li>
<li><code>$httpProvider.defaults.headers.put</code> (header defaults for PUT requests)<ul>
<li><code>Content-Type: application/json</code></li>
</ul>
</li>
</ul>
<p>To add or overwrite these defaults, simply add or remove a property from these configuration
objects. To add headers for an HTTP method other than POST or PUT, simply add a new object
with name equal to the lower-cased http method name, e.g.
<code>$httpProvider.defaults.headers.get['My-Header']='value'</code>.</p>
<p>Additionally, the defaults can be set at runtime via the <code>$http.defaults</code> object in a similar
fashion as described above.</p>
<h3>Transforming Requests and Responses</h3>
with the lowercased HTTP method name as the key, e.g.
<code>$httpProvider.defaults.headers.get[&#39;My-Header&#39;]=&#39;value&#39;</code>.</p>
<p>Additionally, the defaults can be set at runtime via the <code>$http.defaults</code> object in the same
fashion.</p>
<h1>Transforming Requests and Responses</h1>
<p>Both requests and responses can be transformed using transform functions. By default, Angular
applies these transformations:</p>
<p>Request transformations:</p>
<ul>
<li>if the <code>data</code> property of the request config object contains an object, serialize it into
<li>If the <code>data</code> property of the request configuration object contains an object, serialize it into
JSON format.</li>
</ul>
<p>Response transformations:</p>
<ul>
<li>if XSRF prefix is detected, strip it (see Security Considerations section below)</li>
<li>if json response is detected, deserialize it using a JSON parser</li>
<li>If XSRF prefix is detected, strip it (see Security Considerations section below).</li>
<li>If JSON response is detected, deserialize it using a JSON parser.</li>
</ul>
<p>To globally augment or override the default transforms, modify the <code>$httpProvider.defaults.transformRequest</code> and
<code>$httpProvider.defaults.transformResponse</code> properties of the <code>$httpProvider</code>. These properties are by default an
<code>$httpProvider.defaults.transformResponse</code> properties. These properties are by default an
array of transform functions, which allows you to <code>push</code> or <code>unshift</code> a new transformation function into the
transformation chain. You can also decide to completely override any default transformations by assigning your
transformation functions to these properties directly without the array wrapper.</p>
<p>Similarly, to locally override the request/response transforms, augment the <code>transformRequest</code> and/or
<code>transformResponse</code> properties of the config object passed into <code>$http</code>.</p>
<h3>Caching</h3>
<p>To enable caching set the configuration property <code>cache</code> to <code>true</code>. When the cache is
<code>transformResponse</code> properties of the configuration object passed into <code>$http</code>.</p>
<h1>Caching</h1>
<p>To enable caching, set the configuration property <code>cache</code> to <code>true</code>. When the cache is
enabled, <code>$http</code> stores the response from the server in local cache. Next time the
response is served from the cache without sending a request to the server.</p>
<p>Note that even if the response is served from cache, delivery of the data is asynchronous in
the same way that real requests are.</p>
<p>If there are multiple GET requests for the same url that should be cached using the same
<p>If there are multiple GET requests for the same URL that should be cached using the same
cache, but the cache is not populated yet, only one request to the server will be made and
the remaining requests will be fulfilled using the response for the first request.</p>
the remaining requests will be fulfilled using the response from the first request.</p>
<p>A custom default cache built with $cacheFactory can be provided in $http.defaults.cache.
To skip it, set configuration property <code>cache</code> to <code>false</code>.</p>
<h3>Interceptors</h3>
<h1>Interceptors</h1>
<p>Before you start creating interceptors, be sure to understand the
<a href="api/ng.$q"><code>$q and deferred/promise APIs</code></a>.</p>
<p>For purposes of global error handling, authentication or any kind of synchronous or
<p>For purposes of global error handling, authentication, or any kind of synchronous or
asynchronous pre-processing of request or postprocessing of responses, it is desirable to be
able to intercept requests before they are handed to the server and
responses before they are handed over to the application code that
initiated these requests. The interceptors leverage the <a href="api/ng.$q"><code>promise APIs</code></a> to fulfil this need for both synchronous and asynchronous pre-processing.</p>
<p>The interceptors are service factories that are registered with the $httpProvider by
responses before they are handed over to the application code that
initiated these requests. The interceptors leverage the <a href="api/ng.$q"><code>promise APIs</code></a> to fulfill this need for both synchronous and asynchronous pre-processing.</p>
<p>The interceptors are service factories that are registered with the <code>$httpProvider</code> by
adding them to the <code>$httpProvider.interceptors</code> array. The factory is called and
injected with dependencies (if specified) and returns the interceptor.</p>
<p>There are two kinds of interceptors (and two kinds of rejection interceptors):</p>
<ul>
<li><code>request</code>: interceptors get called with http <code>config</code> object. The function is free to modify
the <code>config</code> or create a new one. The function needs to return the <code>config</code> directly or as a
@ -161,7 +131,6 @@ promise.</li>
<li><code>responseError</code>: interceptor gets called when a previous interceptor threw an error or resolved
with a rejection.</li>
</ul>
<pre class="prettyprint linenums">
// register the interceptor as a service
$provide.factory('myHttpInterceptor', function($q, dependency1, dependency2) {
@ -214,22 +183,17 @@ promise.</li>
}
});
</pre>
<h3>Response interceptors (DEPRECATED)</h3>
<h1>Response interceptors (DEPRECATED)</h1>
<p>Before you start creating interceptors, be sure to understand the
<a href="api/ng.$q"><code>$q and deferred/promise APIs</code></a>.</p>
<p>For purposes of global error handling, authentication or any kind of synchronous or
asynchronous preprocessing of received responses, it is desirable to be able to intercept
responses for http requests before they are handed over to the application code that
initiated these requests. The response interceptors leverage the <a href="api/ng.$q"><code>promise apis</code></a> to fulfil this need for both synchronous and asynchronous preprocessing.</p>
<p>The interceptors are service factories that are registered with the $httpProvider by
adding them to the <code>$httpProvider.responseInterceptors</code> array. The factory is called and
injected with dependencies (if specified) and returns the interceptor — a function that
takes a <a href="api/ng.$q"><code>promise</code></a> and returns the original or a new promise.</p>
<pre class="prettyprint linenums">
// register the interceptor as a service
$provide.factory('myHttpInterceptor', function($q, dependency1, dependency2) {
@ -256,60 +220,48 @@ takes a <a href="api/ng.$q"><code>promise</code></a> and returns the original or
}
});
</pre>
<h3>Security Considerations</h3>
<h1>Security Considerations</h3>
<p>When designing web applications, consider security threats from:</p>
<ul>
<li><a href="http://haacked.com/archive/2008/11/20/anatomy-of-a-subtle-json-vulnerability.aspx">JSON Vulnerability</a></li>
<li><a href="http://haacked.com/archive/2008/11/20/anatomy-of-a-subtle-json-vulnerability.aspx">JSON vulnerability</a></li>
<li><a href="http://en.wikipedia.org/wiki/Cross-site_request_forgery">XSRF</a></li>
</ul>
<p>Both server and the client must cooperate in order to eliminate these threats. Angular comes
pre-configured with strategies that address these issues, but for this to work backend server
cooperation is required.</p>
<h4>JSON Vulnerability Protection</h4>
<p>A <a href="http://haacked.com/archive/2008/11/20/anatomy-of-a-subtle-json-vulnerability.aspx">JSON Vulnerability</a> allows third party web-site to turn your JSON resource URL into
<a href="http://en.wikipedia.org/wiki/JSON#JSONP">JSONP</a> request under some conditions. To
counter this your server can prefix all JSON requests with following string <code>")]}',\n"</code>.
<h4>JSON Vulnerability Protection</h2>
<p>A <a href="http://haacked.com/archive/2008/11/20/anatomy-of-a-subtle-json-vulnerability.aspx">JSON vulnerability</a> allows third party website to turn your JSON resource URL into
<a href="http://en.wikipedia.org/wiki/JSONP">JSONP</a> request under some conditions. To
counter this your server can prefix all JSON requests with following string <code>&quot;)]}&#39;,\n&quot;</code>.
Angular will automatically strip the prefix before processing it as JSON.</p>
<p>For example if your server needs to return:
<pre class="prettyprint linenums">
['one','two']
</pre>
<p>which is vulnerable to attack, your server can return:
<pre class="prettyprint linenums">
)]}',
['one','two']
</pre>
<p>Angular will strip the prefix, before processing the JSON.</p>
<h4>Cross Site Request Forgery (XSRF) Protection</h4>
<h2>Cross Site Request Forgery (XSRF) Protection</h4>
<p><a href="http://en.wikipedia.org/wiki/Cross-site_request_forgery">XSRF</a> is a technique by which
an unauthorized site can gain your user's private data. Angular provides following mechanism
an unauthorized site can gain your user&#39;s private data. Angular provides a mechanism
to counter XSRF. When performing XHR requests, the $http service reads a token from a cookie
(by default, <code>XSRF-TOKEN</code>) and sets it as an HTTP header (<code>X-XSRF-TOKEN</code>). Since only
JavaScript that runs on your domain could read the cookie, your server can be assured that
the XHR came from JavaScript running on your domain. The header will not be set for
cross-domain requests.</p>
<p>To take advantage of this, your server needs to set a token in a JavaScript readable session
cookie called <code>XSRF-TOKEN</code> on first HTTP GET request. On subsequent non-GET requests the
cookie called <code>XSRF-TOKEN</code> on the first HTTP GET request. On subsequent XHR requests the
server can verify that the cookie matches <code>X-XSRF-TOKEN</code> HTTP header, and therefore be sure
that only JavaScript running on your domain could have read the token. The token must be
unique for each user and must be verifiable by the server (to prevent the JavaScript making
up its own tokens). We recommend that the token is a digest of your site's authentication
cookie with <a href="http://en.wikipedia.org/wiki/Rainbow_table">salt for added security</a>.</p>
that only JavaScript running on your domain could have sent the request. The token must be
unique for each user and must be verifiable by the server (to prevent the JavaScript from making
up its own tokens). We recommend that the token is a digest of your site&#39;s authentication
cookie with a <a href="https://en.wikipedia.org/wiki/Salt_(cryptography)">salt</a> for added security.</p>
<p>The name of the headers can be specified using the xsrfHeaderName and xsrfCookieName
properties of either $httpProvider.defaults, or the per-request config object.</p></div>
properties of either $httpProvider.defaults, or the per-request config object.</p>
</div></div>
<h2 id="Dependencies">Dependencies</h2>
<ul class="dependencies"><li><code ng:non-bindable=""><a href="api/ng.$httpBackend">$httpBackend</a></code>
</li>
@ -326,18 +278,17 @@ properties of either $httpProvider.defaults, or the per-request config object.</
</ul>
<h2 id="Usage">Usage</h2>
<div class="usage"><pre class="prettyprint linenums">$http(config);</pre>
<h3 id="Parameters">Parameters</h3>
<ul class="parameters"><li><code ng:non-bindable="">config {object} </code>
<p>Object describing the request to be made and how it should be
<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>config</td><td><a href="" class="label type-hint type-hint-object">object</a></td><td><div class="ng-http-page"><p>Object describing the request to be made and how it should be
processed. The object has following properties:</p>
<ul>
<li><strong>method</strong> <code>{string}</code> HTTP method (e.g. 'GET', 'POST', etc)</li>
<li><strong>method</strong> <code>{string}</code> HTTP method (e.g. &#39;GET&#39;, &#39;POST&#39;, etc)</li>
<li><strong>url</strong> <code>{string}</code> Absolute or relative URL of the resource that is being requested.</li>
<li><strong>params</strong> <code>{Object.&lt;string|Object&gt;}</code> Map of strings or objects which will be turned to
<code>?key1=value1&amp;key2=value2</code> after the url. If the value is not a string, it will be JSONified.</li>
<li><strong>data</strong> <code>{string|Object}</code> Data to be sent as the request message data.</li>
<li><strong>headers</strong> <code>{Object}</code> Map of strings representing HTTP headers to send to the server.</li>
<li><strong>headers</strong> <code>{Object}</code> Map of strings or functions which return strings representing
HTTP headers to send to the server. If the return value of a function is null, the header will
not be sent.</li>
<li><strong>xsrfHeaderName</strong> <code>{string}</code> Name of HTTP header to populate with the XSRF token.</li>
<li><strong>xsrfCookieName</strong> <code>{string}</code> Name of cookie containing the XSRF token.</li>
<li><strong>transformRequest</strong> <code>{function(data, headersGetter)|Array.&lt;function(data, headersGetter)&gt;}</code>
@ -350,128 +301,94 @@ response body and headers and returns its transformed (typically deserialized) v
GET request, otherwise if a cache instance built with
<a href="api/ng.$cacheFactory"><code>$cacheFactory</code></a>, this cache will be used for
caching.</li>
<li><strong>timeout</strong> <code>{number}</code> timeout in milliseconds.</li>
<li><strong>timeout</strong> <code>{number|Promise}</code> timeout in milliseconds, or <a href="api/ng.$q"><code>promise</code></a>
that should abort the request when resolved.</li>
<li><strong>withCredentials</strong> - <code>{boolean}</code> - whether to to set the <code>withCredentials</code> flag on the
XHR object. See <a href="https://developer.mozilla.org/en/http_access_control#section_5">requests with credentials</a> for more information.</li>
<li><strong>responseType</strong> - <code>{string}</code> - see <a href="https://developer.mozilla.org/en-US/docs/DOM/XMLHttpRequest#responseType">requestType</a>.</li>
</ul></li>
</ul>
<h3 id="Returns">Returns</h3>
<div class="returns"><code ng:non-bindable="">{HttpPromise}</code>
<p>Returns a <a href="api/ng.$q"><code>promise</code></a> object with the
</div></td></tr></tbody></table><h4 id="returns">Returns</h4><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-httppromise">HttpPromise</a></td><td><div class="ng-http-page"><p>Returns a <a href="api/ng.$q"><code>promise</code></a> object with the
standard <code>then</code> method and two http specific methods: <code>success</code> and <code>error</code>. The <code>then</code>
method takes two arguments a success and an error callback which will be called with a
response object. The <code>success</code> and <code>error</code> methods take a single argument - a function that
will be called when the request succeeds or fails respectively. The arguments passed into
these functions are destructured representation of the response object passed into the
<code>then</code> method. The response object has these properties:</p>
<ul>
<li><strong>data</strong> <code>{string|Object}</code> The response body transformed with the transform functions.</li>
<li><strong>status</strong> <code>{number}</code> HTTP status code of the response.</li>
<li><strong>headers</strong> <code>{function([headerName])}</code> Header getter function.</li>
<li><strong>config</strong> <code>{Object}</code> The configuration object that was used to generate the request.</li>
</ul></div>
</div>
</ul>
</div></td></tr></table></div>
<div class="member method"><h2 id="Methods">Methods</h2>
<ul class="methods"><li><h3 id="delete">delete(url, config)</h3>
<div class="delete"><p>Shortcut method to perform <code>DELETE</code> request</p><h4 id="Parameters">Parameters</h4>
<ul class="parameters"><li><code ng:non-bindable="">url {string} </code>
<p>Relative or absolute URL specifying the destination of the request</p></li>
<li><code ng:non-bindable="">config<i>(optional)</i> {Object=} </code>
<p>Optional configuration object</p></li>
</ul>
<h4 id="Returns">Returns</h4>
<div class="returns"><code ng:non-bindable="">{HttpPromise}</code>
<p>Future object</p></div>
</div>
<div class="delete"><div class="ng-http-delete-page"><p>Shortcut method to perform <code>DELETE</code> request.</p>
</div><h5 id="parameters">Parameters</h5><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>url</td><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="ng-http-delete-page"><p>Relative or absolute URL specifying the destination of the request</p>
</div></td></tr><tr><td>config <div><em>(optional)</em></div></td><td><a href="" class="label type-hint type-hint-object">Object</a></td><td><div class="ng-http-delete-page"><p>Optional configuration object</p>
</div></td></tr></tbody></table><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-httppromise">HttpPromise</a></td><td><div class="ng-http-delete-page"><p>Future object</p>
</div></td></tr></table></div>
</li>
<li><h3 id="get">get(url, config)</h3>
<div class="get"><p>Shortcut method to perform <code>GET</code> request</p><h4 id="Parameters">Parameters</h4>
<ul class="parameters"><li><code ng:non-bindable="">url {string} </code>
<p>Relative or absolute URL specifying the destination of the request</p></li>
<li><code ng:non-bindable="">config<i>(optional)</i> {Object=} </code>
<p>Optional configuration object</p></li>
</ul>
<h4 id="Returns">Returns</h4>
<div class="returns"><code ng:non-bindable="">{HttpPromise}</code>
<p>Future object</p></div>
</div>
<div class="get"><div class="ng-http-get-page"><p>Shortcut method to perform <code>GET</code> request.</p>
</div><h5 id="parameters">Parameters</h5><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>url</td><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="ng-http-get-page"><p>Relative or absolute URL specifying the destination of the request</p>
</div></td></tr><tr><td>config <div><em>(optional)</em></div></td><td><a href="" class="label type-hint type-hint-object">Object</a></td><td><div class="ng-http-get-page"><p>Optional configuration object</p>
</div></td></tr></tbody></table><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-httppromise">HttpPromise</a></td><td><div class="ng-http-get-page"><p>Future object</p>
</div></td></tr></table></div>
</li>
<li><h3 id="head">head(url, config)</h3>
<div class="head"><p>Shortcut method to perform <code>HEAD</code> request</p><h4 id="Parameters">Parameters</h4>
<ul class="parameters"><li><code ng:non-bindable="">url {string} </code>
<p>Relative or absolute URL specifying the destination of the request</p></li>
<li><code ng:non-bindable="">config<i>(optional)</i> {Object=} </code>
<p>Optional configuration object</p></li>
</ul>
<h4 id="Returns">Returns</h4>
<div class="returns"><code ng:non-bindable="">{HttpPromise}</code>
<p>Future object</p></div>
</div>
<div class="head"><div class="ng-http-head-page"><p>Shortcut method to perform <code>HEAD</code> request.</p>
</div><h5 id="parameters">Parameters</h5><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>url</td><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="ng-http-head-page"><p>Relative or absolute URL specifying the destination of the request</p>
</div></td></tr><tr><td>config <div><em>(optional)</em></div></td><td><a href="" class="label type-hint type-hint-object">Object</a></td><td><div class="ng-http-head-page"><p>Optional configuration object</p>
</div></td></tr></tbody></table><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-httppromise">HttpPromise</a></td><td><div class="ng-http-head-page"><p>Future object</p>
</div></td></tr></table></div>
</li>
<li><h3 id="jsonp">jsonp(url, config)</h3>
<div class="jsonp"><p>Shortcut method to perform <code>JSONP</code> request</p><h4 id="Parameters">Parameters</h4>
<ul class="parameters"><li><code ng:non-bindable="">url {string} </code>
<p>Relative or absolute URL specifying the destination of the request.
Should contain <code>JSON_CALLBACK</code> string.</p></li>
<li><code ng:non-bindable="">config<i>(optional)</i> {Object=} </code>
<p>Optional configuration object</p></li>
</ul>
<h4 id="Returns">Returns</h4>
<div class="returns"><code ng:non-bindable="">{HttpPromise}</code>
<p>Future object</p></div>
</div>
<div class="jsonp"><div class="ng-http-jsonp-page"><p>Shortcut method to perform <code>JSONP</code> request.</p>
</div><h5 id="parameters">Parameters</h5><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>url</td><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="ng-http-jsonp-page"><p>Relative or absolute URL specifying the destination of the request.
Should contain <code>JSON_CALLBACK</code> string.</p>
</div></td></tr><tr><td>config <div><em>(optional)</em></div></td><td><a href="" class="label type-hint type-hint-object">Object</a></td><td><div class="ng-http-jsonp-page"><p>Optional configuration object</p>
</div></td></tr></tbody></table><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-httppromise">HttpPromise</a></td><td><div class="ng-http-jsonp-page"><p>Future object</p>
</div></td></tr></table></div>
</li>
<li><h3 id="post">post(url, data, config)</h3>
<div class="post"><p>Shortcut method to perform <code>POST</code> request</p><h4 id="Parameters">Parameters</h4>
<ul class="parameters"><li><code ng:non-bindable="">url {string} </code>
<p>Relative or absolute URL specifying the destination of the request</p></li>
<li><code ng:non-bindable="">data {*} </code>
<p>Request content</p></li>
<li><code ng:non-bindable="">config<i>(optional)</i> {Object=} </code>
<p>Optional configuration object</p></li>
</ul>
<h4 id="Returns">Returns</h4>
<div class="returns"><code ng:non-bindable="">{HttpPromise}</code>
<p>Future object</p></div>
</div>
<div class="post"><div class="ng-http-post-page"><p>Shortcut method to perform <code>POST</code> request.</p>
</div><h5 id="parameters">Parameters</h5><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>url</td><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="ng-http-post-page"><p>Relative or absolute URL specifying the destination of the request</p>
</div></td></tr><tr><td>data</td><td><a href="" class="label type-hint type-hint-object">*</a></td><td><div class="ng-http-post-page"><p>Request content</p>
</div></td></tr><tr><td>config <div><em>(optional)</em></div></td><td><a href="" class="label type-hint type-hint-object">Object</a></td><td><div class="ng-http-post-page"><p>Optional configuration object</p>
</div></td></tr></tbody></table><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-httppromise">HttpPromise</a></td><td><div class="ng-http-post-page"><p>Future object</p>
</div></td></tr></table></div>
</li>
<li><h3 id="put">put(url, data, config)</h3>
<div class="put"><p>Shortcut method to perform <code>PUT</code> request</p><h4 id="Parameters">Parameters</h4>
<ul class="parameters"><li><code ng:non-bindable="">url {string} </code>
<p>Relative or absolute URL specifying the destination of the request</p></li>
<li><code ng:non-bindable="">data {*} </code>
<p>Request content</p></li>
<li><code ng:non-bindable="">config<i>(optional)</i> {Object=} </code>
<p>Optional configuration object</p></li>
</ul>
<h4 id="Returns">Returns</h4>
<div class="returns"><code ng:non-bindable="">{HttpPromise}</code>
<p>Future object</p></div>
</div>
<div class="put"><div class="ng-http-put-page"><p>Shortcut method to perform <code>PUT</code> request.</p>
</div><h5 id="parameters">Parameters</h5><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>url</td><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="ng-http-put-page"><p>Relative or absolute URL specifying the destination of the request</p>
</div></td></tr><tr><td>data</td><td><a href="" class="label type-hint type-hint-object">*</a></td><td><div class="ng-http-put-page"><p>Request content</p>
</div></td></tr><tr><td>config <div><em>(optional)</em></div></td><td><a href="" class="label type-hint type-hint-object">Object</a></td><td><div class="ng-http-put-page"><p>Optional configuration object</p>
</div></td></tr></tbody></table><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-httppromise">HttpPromise</a></td><td><div class="ng-http-put-page"><p>Future object</p>
</div></td></tr></table></div>
</li>
</ul>
</div>
<div class="member property"><h2 id="Properties">Properties</h2>
<ul class="properties"><li><h3 id="defaults">defaults</h3>
<div class="defaults"><p>Runtime equivalent of the <code>$httpProvider.defaults</code> property. Allows configuration of
<div class="defaults"><div class="ng-http-defaults-page"><p>Runtime equivalent of the <code>$httpProvider.defaults</code> property. Allows configuration of
default headers, withCredentials as well as request and response transformations.</p>
<p>See "Setting HTTP Headers" and "Transforming Requests and Responses" sections above.</p></div>
<p>See &quot;Setting HTTP Headers&quot; and &quot;Transforming Requests and Responses&quot; sections above.</p>
</div></div>
</li>
<li><h3 id="pendingRequests">pendingRequests</h3>
<div class="pendingrequests"><p>Array of config objects for currently pending
requests. This is primarily meant to be used for debugging purposes.</p></div>
<div class="pendingrequests"><div class="ng-http-page"><p>Array of config objects for currently pending
requests. This is primarily meant to be used for debugging purposes.</p>
</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-210 http-hello.html" source-edit-css="" source-edit-js="script.js-211" source-edit-unit="" source-edit-scenario="scenario.js-212"></div>
<div class="example"><div class="ng-http-page"><h4>Source</h2>
<div source-edit="" source-edit-deps="angular.js script.js" source-edit-html="index.html-126 http-hello.html" source-edit-css="" source-edit-js="script.js-127" source-edit-json="" source-edit-unit="" source-edit-scenario="scenario.js-128"></div>
<div class="tabbable"><div class="tab-pane" title="index.html">
<pre class="prettyprint linenums" ng-set-text="index.html-210" ng-html-wrap=" angular.js script.js"></pre>
<script type="text/ng-template" id="index.html-210">
<pre class="prettyprint linenums" ng-set-text="index.html-126" ng-html-wrap=" angular.js script.js"></pre>
<script type="text/ng-template" id="index.html-126">
<div ng-controller="FetchCtrl">
<select ng-model="method">
<option>GET</option>
@ -494,8 +411,8 @@ requests. This is primarily meant to be used for debugging purposes.</p></div>
</script>
</div>
<div class="tab-pane" title="script.js">
<pre class="prettyprint linenums" ng-set-text="script.js-211"></pre>
<script type="text/ng-template" id="script.js-211">
<pre class="prettyprint linenums" ng-set-text="script.js-127"></pre>
<script type="text/ng-template" id="script.js-127">
function FetchCtrl($scope, $http, $templateCache) {
$scope.method = 'GET';
$scope.url = 'http-hello.html';
@ -523,8 +440,8 @@ requests. This is primarily meant to be used for debugging purposes.</p></div>
</script>
</div>
<div class="tab-pane" title="End to end test">
<pre class="prettyprint linenums" ng-set-text="scenario.js-212"></pre>
<script type="text/ng-template" id="scenario.js-212">
<pre class="prettyprint linenums" ng-set-text="scenario.js-128"></pre>
<script type="text/ng-template" id="scenario.js-128">
it('should make an xhr GET request', function() {
element(':button:contains("Sample GET")').click();
element(':button:contains("fetch")').click();
@ -548,6 +465,7 @@ requests. This is primarily meant to be used for debugging purposes.</p></div>
});
</script>
</div>
</div><h4>Demo</h4>
<div class="well doc-example-live animator-container" ng-embed-app="" ng-set-html="index.html-210" ng-eval-javascript="script.js-211"></div></div>
</div><h2>Demo</h4>
<div class="well doc-example-live animate-container" ng-embed-app="" ng-set-html="index.html-126" ng-eval-javascript="script.js-127"></div>
</div></div>
</div>

16
lib/angular/docs/partials/api/ng.$httpBackend.html Normal file → Executable file
View file

@ -1,15 +1,15 @@
<h1><code ng:non-bindable="">$httpBackend</code>
<span class="hint">(service in module <code ng:non-bindable="">ng</code>
)</span>
<a href="http://github.com/angular/angular.js/tree/v1.2.0rc1/src/ng/httpBackend.js#L9" 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/httpBackend.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">$httpBackend</code>
<div><span class="hint">service in module <code ng:non-bindable="">ng</code>
</span>
</div>
</h1>
<div><a href="http://github.com/angular/angular.js/edit/master/src/ng/httpBackend.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p>HTTP backend used by the <a href="api/ng.$http"><code>service</code></a> that delegates to
<div><h2 id="Description">Description</h2>
<div class="description"><div class="ng-httpbackend-page"><p>HTTP backend used by the <a href="api/ng.$http"><code>service</code></a> that delegates to
XMLHttpRequest object or JSONP and deals with browser incompatibilities.</p>
<p>You should never need to use this service directly, instead use the higher-level abstractions:
<a href="api/ng.$http"><code>$http</code></a> or <a href="api/ngResource.$resource">$resource</a>.</p>
<p>During testing this implementation is swapped with <a href="api/ngMock.$httpBackend">mock $httpBackend</a> which can be trained with responses.</p></div>
<p>During testing this implementation is swapped with <a href="api/ngMock.$httpBackend">mock $httpBackend</a> which can be trained with responses.</p>
</div></div>
<h2 id="Dependencies">Dependencies</h2>
<ul class="dependencies"><li><code ng:non-bindable=""><a href="api/ng.$browser">$browser</a></code>
</li>

62
lib/angular/docs/partials/api/ng.$interpolate.html Normal file → Executable file
View file

@ -1,61 +1,55 @@
<h1><code ng:non-bindable="">$interpolate</code>
<span class="hint">(service in module <code ng:non-bindable="">ng</code>
)</span>
<a href="http://github.com/angular/angular.js/tree/v1.2.0rc1/src/ng/interpolate.js#L79" 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/interpolate.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">$interpolate</code>
<div><span class="hint">service in module <code ng:non-bindable="">ng</code>
</span>
</div>
</h1>
<div><a href="http://github.com/angular/angular.js/edit/master/src/ng/interpolate.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p>Compiles a string with markup into an interpolation function. This service is used by the
<div><h2 id="Description">Description</h2>
<div class="description"><div class="ng-interpolate-page"><p>Compiles a string with markup into an interpolation function. This service is used by the
HTML <a href="api/ng.$compile"><code>$compile</code></a> service for data binding. See
<a href="api/ng.$interpolateProvider"><code>$interpolateProvider</code></a> for configuring the
interpolation markup.</p>
<pre><code> <pre class="prettyprint linenums">
var $interpolate = ...; // injected
var exp = $interpolate('Hello {{name}}!');
expect(exp({name:'Angular'}).toEqual('Hello Angular!');
</pre>
</code></pre></div>
</pre></code></pre>
</div></div>
<h2 id="Dependencies">Dependencies</h2>
<ul class="dependencies"><li><code ng:non-bindable=""><a href="api/ng.$parse">$parse</a></code>
</li>
<li><code ng:non-bindable=""><a href="api/ng.$sce">$sce</a></code>
</li>
</ul>
<h2 id="Usage">Usage</h2>
<div class="usage"><pre class="prettyprint linenums">$interpolate(text[, mustHaveExpression]);</pre>
<h3 id="Parameters">Parameters</h3>
<ul class="parameters"><li><code ng:non-bindable="">text {string} </code>
<p>The text with markup to interpolate.</p></li>
<li><code ng:non-bindable="">mustHaveExpression<i>(optional)</i> {boolean=} </code>
<p>if set to true then the interpolation string must have
<div class="usage"><pre class="prettyprint linenums">$interpolate(text[, mustHaveExpression][, trustedContext]);</pre>
<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>text</td><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="ng-interpolate-page"><p>The text with markup to interpolate.</p>
</div></td></tr><tr><td>mustHaveExpression <div><em>(optional)</em></div></td><td><a href="" class="label type-hint type-hint-boolean">boolean</a></td><td><div class="ng-interpolate-page"><p>if set to true then the interpolation string must have
embedded expression in order to return an interpolation function. Strings with no
embedded expression will return null for the interpolation function.</p></li>
</ul>
<h3 id="Returns">Returns</h3>
<div class="returns"><code ng:non-bindable="">{function(context)}</code>
<p>an interpolation function which is used to compute the interpolated
embedded expression will return null for the interpolation function.</p>
</div></td></tr><tr><td>trustedContext <div><em>(optional)</em></div></td><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="ng-interpolate-page"><p>when provided, the returned function passes the interpolated
result through <a href="api/ng.$sce#getTrusted"><code>$sce.getTrusted(interpolatedResult, trustedContext)</code></a> before returning it. Refer to the <a href="api/ng.$sce"><code>$sce</code></a> service that
provides Strict Contextual Escaping for details.</p>
</div></td></tr></tbody></table><h4 id="returns">Returns</h4><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-function">function(context)</a></td><td><div class="ng-interpolate-page"><p>an interpolation function which is used to compute the interpolated
string. The function has these parameters:</p>
<ul>
<li><code>context</code>: an object against which any expressions embedded in the strings are evaluated
against.</li>
</ul></div>
</div>
</ul>
</div></td></tr></table></div>
<div class="member method"><h2 id="Methods">Methods</h2>
<ul class="methods"><li><h3 id="endSymbol">endSymbol()</h3>
<div class="endsymbol"><p>Symbol to denote the end of expression in the interpolated string. Defaults to <code>}}</code>.</p>
<div class="endsymbol"><div class="ng-interpolate-endsymbol-page"><p>Symbol to denote the end of expression in the interpolated string. Defaults to <code>}}</code>.</p>
<p>Use <a href="api/ng.$interpolateProvider#endSymbol"><code>$interpolateProvider#endSymbol</code></a> to change
the symbol.</p><h4 id="Returns">Returns</h4>
<div class="returns"><code ng:non-bindable="">{string}</code>
<p>start symbol.</p></div>
</div>
the symbol.</p>
</div><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="ng-interpolate-endsymbol-page"><p>start symbol.</p>
</div></td></tr></table></div>
</li>
<li><h3 id="startSymbol">startSymbol()</h3>
<div class="startsymbol"><p>Symbol to denote the start of expression in the interpolated string. Defaults to <code>{{</code>.</p>
<div class="startsymbol"><div class="ng-interpolate-startsymbol-page"><p>Symbol to denote the start of expression in the interpolated string. Defaults to <code>{{</code>.</p>
<p>Use <a href="api/ng.$interpolateProvider#startSymbol"><code>$interpolateProvider#startSymbol</code></a> to change
the symbol.</p><h4 id="Returns">Returns</h4>
<div class="returns"><code ng:non-bindable="">{string}</code>
<p>start symbol.</p></div>
</div>
the symbol.</p>
</div><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="ng-interpolate-startsymbol-page"><p>start symbol.</p>
</div></td></tr></table></div>
</li>
</ul>
</div>

View file

@ -1,30 +1,51 @@
<h1><code ng:non-bindable="">$interpolateProvider</code>
<span class="hint">(service in module <code ng:non-bindable="">ng</code>
)</span>
<a href="http://github.com/angular/angular.js/tree/v1.2.0rc1/src/ng/interpolate.js#L5" 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/interpolate.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">$interpolateProvider</code>
<div><span class="hint">service in module <code ng:non-bindable="">ng</code>
</span>
</div>
</h1>
<div><a href="http://github.com/angular/angular.js/edit/master/src/ng/interpolate.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p>Used for configuring the interpolation markup. Defaults to <code>{{</code> and <code>}}</code>.</p></div>
<div><h2 id="Description">Description</h2>
<div class="description"><div class="ng-interpolateprovider-page"><p>Used for configuring the interpolation markup. Defaults to <code>{{</code> and <code>}}</code>.</p>
</div></div>
<div class="member method"><h2 id="Methods">Methods</h2>
<ul class="methods"><li><h3 id="endSymbol">endSymbol(value)</h3>
<div class="endsymbol"><p>Symbol to denote the end of expression in the interpolated string. Defaults to <code>}}</code>.</p><h4 id="Parameters">Parameters</h4>
<ul class="parameters"><li><code ng:non-bindable="">value<i>(optional)</i> {string=} </code>
<p>new value to set the ending symbol to.</p></li>
</ul>
<h4 id="Returns">Returns</h4>
<div class="returns"><code ng:non-bindable="">{string|self}</code>
<p>Returns the symbol when used as getter and self if used as setter.</p></div>
</div>
<div class="endsymbol"><div class="ng-interpolateprovider-endsymbol-page"><p>Symbol to denote the end of expression in the interpolated string. Defaults to <code>}}</code>.</p>
</div><h5 id="parameters">Parameters</h5><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>value <div><em>(optional)</em></div></td><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="ng-interpolateprovider-endsymbol-page"><p>new value to set the ending symbol to.</p>
</div></td></tr></tbody></table><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-string">string|self</a></td><td><div class="ng-interpolateprovider-endsymbol-page"><p>Returns the symbol when used as getter and self if used as setter.</p>
</div></td></tr></table></div>
</li>
<li><h3 id="startSymbol">startSymbol(value)</h3>
<div class="startsymbol"><p>Symbol to denote start of expression in the interpolated string. Defaults to <code>{{</code>.</p><h4 id="Parameters">Parameters</h4>
<ul class="parameters"><li><code ng:non-bindable="">value<i>(optional)</i> {string=} </code>
<p>new value to set the starting symbol to.</p></li>
</ul>
<h4 id="Returns">Returns</h4>
<div class="returns"><code ng:non-bindable="">{string|self}</code>
<p>Returns the symbol when used as getter and self if used as setter.</p></div>
</div>
<div class="startsymbol"><div class="ng-interpolateprovider-startsymbol-page"><p>Symbol to denote start of expression in the interpolated string. Defaults to <code>{{</code>.</p>
</div><h5 id="parameters">Parameters</h5><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>value <div><em>(optional)</em></div></td><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="ng-interpolateprovider-startsymbol-page"><p>new value to set the starting symbol to.</p>
</div></td></tr></tbody></table><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-string">string|self</a></td><td><div class="ng-interpolateprovider-startsymbol-page"><p>Returns the symbol when used as getter and self if used as setter.</p>
</div></td></tr></table></div>
</li>
</ul>
</div>
<h2 id="Example">Example</h2>
<div class="example"><div class="ng-interpolateprovider-page"><h4>Source</h2>
<div source-edit="" source-edit-deps="angular.js script.js" source-edit-html="index.html-130" source-edit-css="" source-edit-js="script.js-129" source-edit-json="" source-edit-unit="" source-edit-scenario=""></div>
<div class="tabbable"><div class="tab-pane" title="index.html">
<pre class="prettyprint linenums" ng-set-text="index.html-130" ng-html-wrap=" angular.js script.js"></pre>
<script type="text/ng-template" id="index.html-130">
<div ng-app="App" ng-controller="Controller">
//label//
</div>
</script>
</div>
<div class="tab-pane" title="script.js">
<pre class="prettyprint linenums" ng-set-text="script.js-129"></pre>
<script type="text/ng-template" id="script.js-129">
var myApp = angular.module('App', [], function($interpolateProvider) {
$interpolateProvider.startSymbol('//');
$interpolateProvider.endSymbol('//');
});
function Controller($scope) {
$scope.label = "Interpolation Provider Sample";
}
</script>
</div>
</div><h2>Demo</h4>
<div class="well doc-example-live animate-container" ng-embed-app="" ng-set-html="index.html-130" ng-eval-javascript="script.js-129"></div>
</div></div>
</div>

15
lib/angular/docs/partials/api/ng.$locale.html Normal file → Executable file
View file

@ -1,12 +1,13 @@
<h1><code ng:non-bindable="">$locale</code>
<span class="hint">(service in module <code ng:non-bindable="">ng</code>
)</span>
<a href="http://github.com/angular/angular.js/tree/v1.2.0rc1/src/ng/locale.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/locale.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">$locale</code>
<div><span class="hint">service in module <code ng:non-bindable="">ng</code>
</span>
</div>
</h1>
<div><a href="http://github.com/angular/angular.js/edit/master/src/ng/locale.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p>$locale service provides localization rules for various Angular components. As of right now the
<div><h2 id="Description">Description</h2>
<div class="description"><div class="ng-locale-page"><p>$locale service provides localization rules for various Angular components. As of right now the
only public api is:</p>
<ul>
<li><code>id</code> <code>{string}</code> locale id formatted as <code>languageId-countryId</code> (e.g. <code>en-us</code>)</li>
</ul></div>
</ul>
</div></div>
</div>

152
lib/angular/docs/partials/api/ng.$location.html Normal file → Executable file
View file

@ -1,27 +1,30 @@
<h1><code ng:non-bindable="">$location</code>
<span class="hint">(service in module <code ng:non-bindable="">ng</code>
)</span>
<a href="http://github.com/angular/angular.js/tree/v1.2.0rc1/src/ng/location.js#L445" 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/location.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">$location</code>
<div><span class="hint">service in module <code ng:non-bindable="">ng</code>
</span>
</div>
</h1>
<div><a href="http://github.com/angular/angular.js/edit/master/src/ng/location.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p>The $location service parses the URL in the browser address bar (based on the
<div><h2 id="Description">Description</h2>
<div class="description"><div class="ng-location-page"><p>The $location service parses the URL in the browser address bar (based on the
<a href="https://developer.mozilla.org/en/window.location">window.location</a>) and makes the URL
available to your application. Changes to the URL in the address bar are reflected into
$location service and changes to $location are reflected into the browser address bar.</p>
<p><strong>The $location service:</strong></p>
<ul>
<li>Exposes the current URL in the browser address bar, so you can
<ul><li>Watch and observe the URL.</li>
<li>Change the URL.</li></ul></li>
<li>Synchronizes the URL with the browser when the user
<ul><li>Changes the address bar.</li>
<li>Exposes the current URL in the browser address bar, so you can<ul>
<li>Watch and observe the URL.</li>
<li>Change the URL.</li>
</ul>
</li>
<li>Synchronizes the URL with the browser when the user<ul>
<li>Changes the address bar.</li>
<li>Clicks the back or forward button (or clicks a History link).</li>
<li>Clicks on a link.</li></ul></li>
<li>Clicks on a link.</li>
</ul>
</li>
<li>Represents the URL object as a set of methods (protocol, host, port, path, search, hash).</li>
</ul>
<p>For more information see <a href="guide/dev_guide.services.$location">Developer Guide: Angular Services: Using $location</a></p></div>
<p>For more information see <a href="guide/dev_guide.services.$location">Developer Guide: Angular Services: Using $location</a></p>
</div></div>
<h2 id="Dependencies">Dependencies</h2>
<ul class="dependencies"><li><code ng:non-bindable=""><a href="api/ng.$browser">$browser</a></code>
</li>
@ -32,103 +35,72 @@ $location service and changes to $location are reflected into the browser addres
</ul>
<div class="member method"><h2 id="Methods">Methods</h2>
<ul class="methods"><li><h3 id="absUrl">absUrl()</h3>
<div class="absurl"><p>This method is getter only.</p>
<div class="absurl"><div class="ng-location-absurl-page"><p>This method is getter only.</p>
<p>Return full url representation with all segments encoded according to rules specified in
<a href="http://www.ietf.org/rfc/rfc3986.txt">RFC 3986</a>.</p><h4 id="Returns">Returns</h4>
<div class="returns"><code ng:non-bindable="">{string}</code>
<p>full url</p></div>
</div>
<a href="http://www.ietf.org/rfc/rfc3986.txt">RFC 3986</a>.</p>
</div><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="ng-location-absurl-page"><p>full url</p>
</div></td></tr></table></div>
</li>
<li><h3 id="hash">hash(hash)</h3>
<div class="hash"><p>This method is getter / setter.</p>
<div class="hash"><div class="ng-location-hash-page"><p>This method is getter / setter.</p>
<p>Return hash fragment when called without any parameter.</p>
<p>Change hash fragment when called with parameter and return <code>$location</code>.</p><h4 id="Parameters">Parameters</h4>
<ul class="parameters"><li><code ng:non-bindable="">hash<i>(optional)</i> {string=} </code>
<p>New hash fragment</p></li>
</ul>
<h4 id="Returns">Returns</h4>
<div class="returns"><code ng:non-bindable="">{string}</code>
<p>hash</p></div>
</div>
<p>Change hash fragment when called with parameter and return <code>$location</code>.</p>
</div><h5 id="parameters">Parameters</h5><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>hash <div><em>(optional)</em></div></td><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="ng-location-hash-page"><p>New hash fragment</p>
</div></td></tr></tbody></table><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="ng-location-hash-page"><p>hash</p>
</div></td></tr></table></div>
</li>
<li><h3 id="host">host()</h3>
<div class="host"><p>This method is getter only.</p>
<p>Return host of current url.</p><h4 id="Returns">Returns</h4>
<div class="returns"><code ng:non-bindable="">{string}</code>
<p>host of current url.</p></div>
</div>
<div class="host"><div class="ng-location-host-page"><p>This method is getter only.</p>
<p>Return host of current url.</p>
</div><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="ng-location-host-page"><p>host of current url.</p>
</div></td></tr></table></div>
</li>
<li><h3 id="path">path(path)</h3>
<div class="path"><p>This method is getter / setter.</p>
<div class="path"><div class="ng-location-path-page"><p>This method is getter / setter.</p>
<p>Return path of current url when called without any parameter.</p>
<p>Change path when called with parameter and return <code>$location</code>.</p>
<p>Note: Path should always begin with forward slash (/), this method will add the forward slash
if it is missing.</p><h4 id="Parameters">Parameters</h4>
<ul class="parameters"><li><code ng:non-bindable="">path<i>(optional)</i> {string=} </code>
<p>New path</p></li>
</ul>
<h4 id="Returns">Returns</h4>
<div class="returns"><code ng:non-bindable="">{string}</code>
<p>path</p></div>
</div>
if it is missing.</p>
</div><h5 id="parameters">Parameters</h5><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>path <div><em>(optional)</em></div></td><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="ng-location-path-page"><p>New path</p>
</div></td></tr></tbody></table><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="ng-location-path-page"><p>path</p>
</div></td></tr></table></div>
</li>
<li><h3 id="port">port()</h3>
<div class="port"><p>This method is getter only.</p>
<p>Return port of current url.</p><h4 id="Returns">Returns</h4>
<div class="returns"><code ng:non-bindable="">{Number}</code>
<p>port</p></div>
</div>
<div class="port"><div class="ng-location-port-page"><p>This method is getter only.</p>
<p>Return port of current url.</p>
</div><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-number">Number</a></td><td><div class="ng-location-port-page"><p>port</p>
</div></td></tr></table></div>
</li>
<li><h3 id="protocol">protocol()</h3>
<div class="protocol"><p>This method is getter only.</p>
<p>Return protocol of current url.</p><h4 id="Returns">Returns</h4>
<div class="returns"><code ng:non-bindable="">{string}</code>
<p>protocol of current url</p></div>
</div>
<div class="protocol"><div class="ng-location-protocol-page"><p>This method is getter only.</p>
<p>Return protocol of current url.</p>
</div><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="ng-location-protocol-page"><p>protocol of current url</p>
</div></td></tr></table></div>
</li>
<li><h3 id="replace">replace()</h3>
<div class="replace"><p>If called, all changes to $location during current <code>$digest</code> will be replacing current history
record, instead of adding new one.</p></div>
<div class="replace"><div class="ng-location-replace-page"><p>If called, all changes to $location during current <code>$digest</code> will be replacing current history
record, instead of adding new one.</p>
</div></div>
</li>
<li><h3 id="search">search(search, paramValue)</h3>
<div class="search"><p>This method is getter / setter.</p>
<div class="search"><div class="ng-location-search-page"><p>This method is getter / setter.</p>
<p>Return search part (as object) of current url when called without any parameter.</p>
<p>Change search part when called with parameter and return <code>$location</code>.</p><h4 id="Parameters">Parameters</h4>
<ul class="parameters"><li><code ng:non-bindable="">search<i>(optional)</i> {string|object&lt;string,string&gt;=} </code>
<p>New search params - string or hash object</p></li>
<li><code ng:non-bindable="">paramValue<i>(optional)</i> {string=} </code>
<p>If <code>search</code> is a string, then <code>paramValue</code> will override only a
single search parameter. If the value is <code>null</code>, the parameter will be deleted.</p></li>
</ul>
<h4 id="Returns">Returns</h4>
<div class="returns"><code ng:non-bindable="">{string}</code>
<p>search</p></div>
</div>
<p>Change search part when called with parameter and return <code>$location</code>.</p>
</div><h5 id="parameters">Parameters</h5><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>search</td><td><a href="" class="label type-hint type-hint-string">string</a><a href="" class="label type-hint type-hint-object">Object.&lt;string&gt;</a><a href="" class="label type-hint type-hint-object">Object.&lt;Array.&lt;string&gt;&gt;</a></td><td><div class="ng-location-search-page"><p>New search params - string or hash object. Hash object
may contain an array of values, which will be decoded as duplicates in the url.</p>
</div></td></tr><tr><td>paramValue <div><em>(optional)</em></div></td><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="ng-location-search-page"><p>If <code>search</code> is a string, then <code>paramValue</code> will override only a
single search parameter. If the value is <code>null</code>, the parameter will be deleted.</p>
</div></td></tr></tbody></table><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="ng-location-search-page"><p>search</p>
</div></td></tr></table></div>
</li>
<li><h3 id="url">url(url)</h3>
<div class="url"><p>This method is getter / setter.</p>
<li><h3 id="url">url(url, replace)</h3>
<div class="url"><div class="ng-location-url-page"><p>This method is getter / setter.</p>
<p>Return url (e.g. <code>/path?a=b#hash</code>) when called without any parameter.</p>
<p>Change path, search and hash, when called with parameter and return <code>$location</code>.</p><h4 id="Parameters">Parameters</h4>
<ul class="parameters"><li><code ng:non-bindable="">url<i>(optional)</i> {string=} </code>
<p>New url without base prefix (e.g. <code>/path?a=b#hash</code>)</p></li>
</ul>
<h4 id="Returns">Returns</h4>
<div class="returns"><code ng:non-bindable="">{string}</code>
<p>url</p></div>
</div>
<p>Change path, search and hash, when called with parameter and return <code>$location</code>.</p>
</div><h5 id="parameters">Parameters</h5><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>url <div><em>(optional)</em></div></td><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="ng-location-url-page"><p>New url without base prefix (e.g. <code>/path?a=b#hash</code>)</p>
</div></td></tr><tr><td>replace <div><em>(optional)</em></div></td><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="ng-location-url-page"><p>The path that will be changed</p>
</div></td></tr></tbody></table><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="ng-location-url-page"><p>url</p>
</div></td></tr></table></div>
</li>
</ul>
</div>

34
lib/angular/docs/partials/api/ng.$locationProvider.html Normal file → Executable file
View file

@ -1,29 +1,21 @@
<h1><code ng:non-bindable="">$locationProvider</code>
<span class="hint">(service in module <code ng:non-bindable="">ng</code>
)</span>
<a href="http://github.com/angular/angular.js/tree/v1.2.0rc1/src/ng/location.js#L474" 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/location.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">$locationProvider</code>
<div><span class="hint">service in module <code ng:non-bindable="">ng</code>
</span>
</div>
</h1>
<div><a href="http://github.com/angular/angular.js/edit/master/src/ng/location.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p>Use the <code>$locationProvider</code> to configure how the application deep linking paths are stored.</p></div>
<div><h2 id="Description">Description</h2>
<div class="description"><div class="ng-locationprovider-page"><p>Use the <code>$locationProvider</code> to configure how the application deep linking paths are stored.</p>
</div></div>
<div class="member method"><h2 id="Methods">Methods</h2>
<ul class="methods"><li><h3 id="hashPrefix">hashPrefix(prefix)</h3>
<div class="hashprefix"><h4 id="Parameters">Parameters</h4>
<ul class="parameters"><li><code ng:non-bindable="">prefix<i>(optional)</i> {string=} </code>
<p>Prefix for hash part (containing path and search)</p></li>
</ul>
<h4 id="Returns">Returns</h4>
<div class="returns"><code ng:non-bindable="">{*}</code>
<p>current value if used as getter or itself (chaining) if used as setter</p></div>
</div>
<div class="hashprefix"><h5 id="parameters">Parameters</h5><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>prefix <div><em>(optional)</em></div></td><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="ng-locationprovider-hashprefix-page"><p>Prefix for hash part (containing path and search)</p>
</div></td></tr></tbody></table><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-object">*</a></td><td><div class="ng-locationprovider-hashprefix-page"><p>current value if used as getter or itself (chaining) if used as setter</p>
</div></td></tr></table></div>
</li>
<li><h3 id="html5Mode">html5Mode(mode)</h3>
<div class="html5mode"><h4 id="Parameters">Parameters</h4>
<ul class="parameters"><li><code ng:non-bindable="">mode<i>(optional)</i> {string=} </code>
<p>Use HTML5 strategy if available.</p></li>
</ul>
<h4 id="Returns">Returns</h4>
<div class="returns"><code ng:non-bindable="">{*}</code>
<p>current value if used as getter or itself (chaining) if used as setter</p></div>
</div>
<div class="html5mode"><h5 id="parameters">Parameters</h5><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>mode <div><em>(optional)</em></div></td><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="ng-locationprovider-html5mode-page"><p>Use HTML5 strategy if available.</p>
</div></td></tr></tbody></table><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-object">*</a></td><td><div class="ng-locationprovider-html5mode-page"><p>current value if used as getter or itself (chaining) if used as setter</p>
</div></td></tr></table></div>
</li>
</ul>
</div>

51
lib/angular/docs/partials/api/ng.$log.html Normal file → Executable file
View file

@ -1,40 +1,46 @@
<h1><code ng:non-bindable="">$log</code>
<span class="hint">(service in module <code ng:non-bindable="">ng</code>
)</span>
<a href="http://github.com/angular/angular.js/tree/v1.2.0rc1/src/ng/log.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/log.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">$log</code>
<div><span class="hint">service in module <code ng:non-bindable="">ng</code>
</span>
</div>
</h1>
<div><a href="http://github.com/angular/angular.js/edit/master/src/ng/log.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p>Simple service for logging. Default implementation writes the message
into the browser's console (if present).</p>
<p>The main purpose of this service is to simplify debugging and troubleshooting.</p></div>
<div><h2 id="Description">Description</h2>
<div class="description"><div class="ng-log-page"><p>Simple service for logging. Default implementation writes the message
into the browser&#39;s console (if present).</p>
<p>The main purpose of this service is to simplify debugging and troubleshooting.</p>
</div></div>
<h2 id="Dependencies">Dependencies</h2>
<ul class="dependencies"><li><code ng:non-bindable=""><a href="api/ng.$window">$window</a></code>
<ul class="dependencies"><li><code ng:non-bindable=""><a href="../../../../../index.htmlndow">$window</a></code>
</li>
</ul>
<div class="member method"><h2 id="Methods">Methods</h2>
<ul class="methods"><li><h3 id="debug">debug()</h3>
<div class="debug"><p>Write a debug message</p></div>
<div class="debug"><div class="ng-log-debug-page"><p>Write a debug message</p>
</div></div>
</li>
<li><h3 id="error">error()</h3>
<div class="error"><p>Write an error message</p></div>
<div class="error"><div class="ng-log-error-page"><p>Write an error message</p>
</div></div>
</li>
<li><h3 id="info">info()</h3>
<div class="info"><p>Write an information message</p></div>
<div class="info"><div class="ng-log-info-page"><p>Write an information message</p>
</div></div>
</li>
<li><h3 id="log">log()</h3>
<div class="log"><p>Write a log message</p></div>
<div class="log"><div class="ng-log-log-page"><p>Write a log message</p>
</div></div>
</li>
<li><h3 id="warn">warn()</h3>
<div class="warn"><p>Write a warning message</p></div>
<div class="warn"><div class="ng-log-warn-page"><p>Write a warning message</p>
</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-214" source-edit-css="" source-edit-js="script.js-213" source-edit-unit="" source-edit-scenario=""></div>
<div class="example"><div class="ng-log-page"><h4>Source</h2>
<div source-edit="" source-edit-deps="angular.js script.js" source-edit-html="index.html-132" source-edit-css="" source-edit-js="script.js-131" source-edit-json="" source-edit-unit="" source-edit-scenario=""></div>
<div class="tabbable"><div class="tab-pane" title="index.html">
<pre class="prettyprint linenums" ng-set-text="index.html-214" ng-html-wrap=" angular.js script.js"></pre>
<script type="text/ng-template" id="index.html-214">
<pre class="prettyprint linenums" ng-set-text="index.html-132" ng-html-wrap=" angular.js script.js"></pre>
<script type="text/ng-template" id="index.html-132">
<div ng-controller="LogCtrl">
<p>Reload this page with open console, enter text and hit the log button...</p>
Message:
@ -47,14 +53,15 @@ into the browser's console (if present).</p>
</script>
</div>
<div class="tab-pane" title="script.js">
<pre class="prettyprint linenums" ng-set-text="script.js-213"></pre>
<script type="text/ng-template" id="script.js-213">
<pre class="prettyprint linenums" ng-set-text="script.js-131"></pre>
<script type="text/ng-template" id="script.js-131">
function LogCtrl($scope, $log) {
$scope.$log = $log;
$scope.message = 'Hello World!';
}
</script>
</div>
</div><h4>Demo</h4>
<div class="well doc-example-live animator-container" ng-embed-app="" ng-set-html="index.html-214" ng-eval-javascript="script.js-213"></div></div>
</div><h2>Demo</h4>
<div class="well doc-example-live animate-container" ng-embed-app="" ng-set-html="index.html-132" ng-eval-javascript="script.js-131"></div>
</div></div>
</div>

23
lib/angular/docs/partials/api/ng.$logProvider.html Normal file → Executable file
View file

@ -1,19 +1,16 @@
<h1><code ng:non-bindable="">$logProvider</code>
<span class="hint">(service in module <code ng:non-bindable="">ng</code>
)</span>
<a href="http://github.com/angular/angular.js/tree/v1.2.0rc1/src/ng/log.js#L36" 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/log.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">$logProvider</code>
<div><span class="hint">service in module <code ng:non-bindable="">ng</code>
</span>
</div>
</h1>
<div><a href="http://github.com/angular/angular.js/edit/master/src/ng/log.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p>Use the <code>$logProvider</code> to configure how the application logs messages</p></div>
<div><h2 id="Description">Description</h2>
<div class="description"><div class="ng-logprovider-page"><p>Use the <code>$logProvider</code> to configure how the application logs messages</p>
</div></div>
<div class="member method"><h2 id="Methods">Methods</h2>
<ul class="methods"><li><h3 id="debugEnabled">debugEnabled(flag)</h3>
<div class="debugenabled"><h4 id="Parameters">Parameters</h4>
<ul class="parameters"><li><code ng:non-bindable="">flag<i>(optional)</i> {string=} </code>
<p>enable or disable debug level messages</p></li>
</ul>
<h4 id="Returns">Returns</h4>
<div class="returns"><code ng:non-bindable="">{*}</code>
<p>current value if used as getter or itself (chaining) if used as setter</p></div>
</div>
<div class="debugenabled"><h5 id="parameters">Parameters</h5><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>flag <div><em>(optional)</em></div></td><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="ng-logprovider-debugenabled-page"><p>enable or disable debug level messages</p>
</div></td></tr></tbody></table><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-object">*</a></td><td><div class="ng-logprovider-debugenabled-page"><p>current value if used as getter or itself (chaining) if used as setter</p>
</div></td></tr></table></div>
</li>
</ul>
</div>

42
lib/angular/docs/partials/api/ng.$parse.html Normal file → Executable file
View file

@ -1,10 +1,10 @@
<h1><code ng:non-bindable="">$parse</code>
<span class="hint">(service in module <code ng:non-bindable="">ng</code>
)</span>
<a href="http://github.com/angular/angular.js/tree/v1.2.0rc1/src/ng/parse.js#L916" 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/parse.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">$parse</code>
<div><span class="hint">service in module <code ng:non-bindable="">ng</code>
</span>
</div>
</h1>
<div><a href="http://github.com/angular/angular.js/edit/master/src/ng/parse.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p>Converts Angular <a href="guide/expression">expression</a> into a function.</p>
<div><h2 id="Description">Description</h2>
<div class="description"><div class="ng-parse-page"><p>Converts Angular <a href="guide/expression">expression</a> into a function.</p>
<pre class="prettyprint linenums">
var getter = $parse('user.name');
var setter = getter.assign;
@ -15,31 +15,27 @@
setter(context, 'newValue');
expect(context.user.name).toEqual('newValue');
expect(getter(context, locals)).toEqual('local');
</pre></div>
</pre>
</div></div>
<h2 id="Usage">Usage</h2>
<div class="usage"><pre class="prettyprint linenums">$parse(expression);</pre>
<h3 id="Parameters">Parameters</h3>
<ul class="parameters"><li><code ng:non-bindable="">expression {string} </code>
<p>String expression to compile.</p></li>
</ul>
<h3 id="Returns">Returns</h3>
<div class="returns"><code ng:non-bindable="">{function(context, locals)}</code>
<p>a function which represents the compiled expression:</p>
<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>expression</td><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="ng-parse-page"><p>String expression to compile.</p>
</div></td></tr></tbody></table><h4 id="returns">Returns</h4><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-function">function(context, locals)</a></td><td><div class="ng-parse-page"><p>a function which represents the compiled expression:</p>
<ul>
<li><code>context</code> <code>{object}</code> an object against which any expressions embedded in the strings
are evaluated against (typically a scope object).</li>
are evaluated against (typically a scope object).</li>
<li><p><code>locals</code> <code>{object=}</code> local variables context object, useful for overriding values in
<code>context</code>.</p>
<code>context</code>.</p>
<p>The returned function also has the following properties:</p>
<ul><li><code>literal</code> <code>{boolean}</code> whether the expression's top-level node is a JavaScript
<ul>
<li><code>literal</code> <code>{boolean}</code> whether the expression&#39;s top-level node is a JavaScript
literal.</li>
<li><code>constant</code> <code>{boolean}</code> whether the expression is made entirely of JavaScript
constant literals.</li>
<li><code>assign</code> <code>{?function(context, value)}</code> if the expression is assignable, this will be
set to a function to change its value on the given context.</li></ul></li>
</ul></div>
</div>
set to a function to change its value on the given context.</li>
</ul>
</li>
</ul>
</div></td></tr></table></div>
</div>

152
lib/angular/docs/partials/api/ng.$q.html Normal file → Executable file
View file

@ -1,17 +1,15 @@
<h1><code ng:non-bindable="">$q</code>
<span class="hint">(service in module <code ng:non-bindable="">ng</code>
)</span>
<a href="http://github.com/angular/angular.js/tree/v1.2.0rc1/src/ng/q.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/q.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">$q</code>
<div><span class="hint">service in module <code ng:non-bindable="">ng</code>
</span>
</div>
</h1>
<div><a href="http://github.com/angular/angular.js/edit/master/src/ng/q.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p>A promise/deferred implementation inspired by <a href="https://github.com/kriskowal/q">Kris Kowal's Q</a>.</p>
<div><h2 id="Description">Description</h2>
<div class="description"><div class="ng-q-page"><p>A promise/deferred implementation inspired by <a href="https://github.com/kriskowal/q">Kris Kowal&#39;s Q</a>.</p>
<p><a href="http://wiki.commonjs.org/wiki/Promises">The CommonJS Promise proposal</a> describes a promise as an
interface for interacting with an object that represents the result of an action that is
performed asynchronously, and may or may not be finished at any given point in time.</p>
<p>From the perspective of dealing with error handling, deferred and promise APIs are to
asynchronous programming what <code>try</code>, <code>catch</code> and <code>throw</code> keywords are to synchronous programming.</p>
<pre class="prettyprint linenums">
// for the purpose of this example let's assume that variables `$q` and `scope` are
// available in the current lexical scope (they could have been injected or passed in).
@ -41,91 +39,79 @@ asynchronous programming what <code>try</code>, <code>catch</code> and <code>thr
alert('Failed: ' + reason);
});
</pre>
<p>At first it might not be obvious why this extra complexity is worth the trouble. The payoff
comes in the way of
<a href="https://github.com/kriskowal/uncommonjs/blob/master/promises/specification.md">guarantees that promise and deferred APIs make</a>.</p>
<p>Additionally the promise api allows for composition that is very hard to do with the
traditional callback (<a href="http://en.wikipedia.org/wiki/Continuation-passing_style">CPS</a>) approach.
For more on this please see the <a href="https://github.com/kriskowal/q">Q documentation</a> especially the
section on serial or parallel joining of promises.</p>
<h3>The Deferred API</h3>
<h3>The Deferred API</h1>
<p>A new instance of deferred is constructed by calling <code>$q.defer()</code>.</p>
<p>The purpose of the deferred object is to expose the associated Promise instance as well as APIs
that can be used for signaling the successful or unsuccessful completion of the task.</p>
<p><strong>Methods</strong></p>
<ul>
<li><code>resolve(value)</code> resolves the derived promise with the <code>value</code>. If the value is a rejection
constructed via <code>$q.reject</code>, the promise will be rejected instead.</li>
<li><code>reject(reason)</code> rejects the derived promise with the <code>reason</code>. This is equivalent to
resolving it with a rejection constructed via <code>$q.reject</code>.</li>
</ul>
<p><strong>Properties</strong></p>
<ul>
<li>promise <code>{Promise}</code> promise object associated with this deferred.</li>
</ul>
<h3>The Promise API</h3>
<h1>The Promise API</h1>
<p>A new promise instance is created when a deferred instance is created and can be retrieved by
calling <code>deferred.promise</code>.</p>
<p>The purpose of the promise object is to allow for interested parties to get access to the result
of the deferred task when it completes.</p>
<p><strong>Methods</strong></p>
<ul>
<li><p><code>then(successCallback, errorCallback)</code> regardless of when the promise was or will be resolved
or rejected calls one of the success or error callbacks asynchronously as soon as the result
is available. The callbacks are called with a single argument the result or rejection reason.</p>
or rejected, <code>then</code> calls one of the success or error callbacks asynchronously as soon as the result
is available. The callbacks are called with a single argument: the result or rejection reason.</p>
<p>This method <em>returns a new promise</em> which is resolved or rejected via the return value of the
<code>successCallback</code> or <code>errorCallback</code>.</p></li>
<code>successCallback</code> or <code>errorCallback</code>.</p>
</li>
<li><p><code>catch(errorCallback)</code> shorthand for <code>promise.then(null, errorCallback)</code></p>
</li>
<li><p><code>finally(callback)</code> allows you to observe either the fulfillment or rejection of a promise,
but to do so without modifying the final value. This is useful to release resources or do some
clean-up that needs to be done whether the promise was rejected or resolved. See the <a href="https://github.com/kriskowal/q/wiki/API-Reference#promisefinallycallback">full
specification</a> for
more information.</p>
<p>Because <code>finally</code> is a reserved word in JavaScript and reserved keywords are not supported as
property names by ES3, you&#39;ll need to invoke the method like <code>promise[&#39;finally&#39;](callback)</code> to
make your code IE8 compatible.</p>
</li>
</ul>
<h3>Chaining promises</h3>
<p>Because calling <code>then</code> api of a promise returns a new derived promise, it is easily possible
<h1>Chaining promises</h1>
<p>Because calling the <code>then</code> method of a promise returns a new derived promise, it is easily possible
to create a chain of promises:</p>
<pre class="prettyprint linenums">
promiseB = promiseA.then(function(result) {
return result + 1;
});
// promiseB will be resolved immediately after promiseA is resolved and its value will be
// the result of promiseA incremented by 1
// promiseB will be resolved immediately after promiseA is resolved and its value
// will be the result of promiseA incremented by 1
</pre>
<p>It is possible to create chains of any length and since a promise can be resolved with another
promise (which will defer its resolution further), it is possible to pause/defer resolution of
the promises at any point in the chain. This makes it possible to implement powerful apis like
$http's response interceptors.</p>
<h3>Differences between Kris Kowal's Q and $q</h3>
<p>There are three main differences:</p>
the promises at any point in the chain. This makes it possible to implement powerful APIs like
$http&#39;s response interceptors.</p>
<h1>Differences between Kris Kowal&#39;s Q and $q</h1>
<p> There are three main differences:</p>
<ul>
<li>$q is integrated with the <a href="api/ng.$rootScope.Scope"><code>ng.$rootScope.Scope</code></a> Scope model observation
<li>$q is integrated with the <a href="../../../../../index.htmlotScope.Scope"><code>ng.$rootScope.Scope</code></a> Scope model observation
mechanism in angular, which means faster propagation of resolution or rejection into your
models and avoiding unnecessary browser repaints, which would result in flickering UI.</li>
<li>$q promises are recognized by the templating engine in angular, which means that in templates
you can treat promises attached to a scope as if they were the resulting values.</li>
<li><p>Q has many more features that $q, but that comes at a cost of bytes. $q is tiny, but contains
<li><p>Q has many more features than $q, but that comes at a cost of bytes. $q is tiny, but contains
all the important functionality needed for common async tasks.</p>
<h3>Testing</h3>
<h1>Testing</h3>
<pre class="prettyprint linenums">
it('should simulate promise', inject(function($q, $rootScope) {
var deferred = $q.defer();
@ -146,44 +132,39 @@ all the important functionality needed for common async tasks.</p>
$rootScope.$apply();
expect(resolvedValue).toEqual(123);
});
</pre></li>
</ul></div>
</pre>
</li>
</ul>
</div></div>
<h2 id="Dependencies">Dependencies</h2>
<ul class="dependencies"><li><code ng:non-bindable=""><a href="api/ng.$rootScope">$rootScope</a></code>
<ul class="dependencies"><li><code ng:non-bindable=""><a href="../../../../../index.htmlotScope">$rootScope</a></code>
</li>
</ul>
<div class="member method"><h2 id="Methods">Methods</h2>
<ul class="methods"><li><h3 id="all">all(promises)</h3>
<div class="all"><p>Combines multiple promises into a single promise that is resolved when all of the input
promises are resolved.</p><h4 id="Parameters">Parameters</h4>
<ul class="parameters"><li><code ng:non-bindable="">promises {Array.&lt;Promise&gt;|Object.&lt;Promise&gt;} </code>
<p>An array or hash of promises.</p></li>
</ul>
<h4 id="Returns">Returns</h4>
<div class="returns"><code ng:non-bindable="">{Promise}</code>
<p>Returns a single promise that will be resolved with an array/hash of values,
<div class="all"><div class="ng-q-all-page"><p>Combines multiple promises into a single promise that is resolved when all of the input
promises are resolved.</p>
</div><h5 id="parameters">Parameters</h5><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>promises</td><td><a href="" class="label type-hint type-hint-array">Array.&lt;Promise&gt;</a><a href="" class="label type-hint type-hint-object">Object.&lt;Promise&gt;</a></td><td><div class="ng-q-all-page"><p>An array or hash of promises.</p>
</div></td></tr></tbody></table><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-promise">Promise</a></td><td><div class="ng-q-all-page"><p>Returns a single promise that will be resolved with an array/hash of values,
each value corresponding to the promise at the same index/key in the <code>promises</code> array/hash. If any of
the promises is resolved with a rejection, this resulting promise will be resolved with the
same rejection.</p></div>
</div>
same rejection.</p>
</div></td></tr></table></div>
</li>
<li><h3 id="defer">defer()</h3>
<div class="defer"><p>Creates a <code>Deferred</code> object which represents a task which will finish in the future.</p><h4 id="Returns">Returns</h4>
<div class="returns"><code ng:non-bindable="">{Deferred}</code>
<p>Returns a new instance of deferred.</p></div>
</div>
<div class="defer"><div class="ng-q-defer-page"><p>Creates a <code>Deferred</code> object which represents a task which will finish in the future.</p>
</div><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-deferred">Deferred</a></td><td><div class="ng-q-defer-page"><p>Returns a new instance of deferred.</p>
</div></td></tr></table></div>
</li>
<li><h3 id="reject">reject(reason)</h3>
<div class="reject"><p>Creates a promise that is resolved as rejected with the specified <code>reason</code>. This api should be
<div class="reject"><div class="ng-q-reject-page"><p>Creates a promise that is resolved as rejected with the specified <code>reason</code>. This api should be
used to forward rejection in a chain of promises. If you are dealing with the last promise in
a promise chain, you don't need to worry about it.</p>
a promise chain, you don&#39;t need to worry about it.</p>
<p>When comparing deferreds/promises to the familiar behavior of try/catch/throw, think of
<code>reject</code> as the <code>throw</code> keyword in JavaScript. This also means that if you "catch" an error via
<code>reject</code> as the <code>throw</code> keyword in JavaScript. This also means that if you &quot;catch&quot; an error via
a promise error callback and you want to forward the error to the promise derived from the
current promise, you have to "rethrow" the error by returning a rejection constructed via
current promise, you have to &quot;rethrow&quot; the error by returning a rejection constructed via
<code>reject</code>.</p>
<pre class="prettyprint linenums">
promiseB = promiseA.then(function(result) {
// success: do something and resolve promiseB
@ -199,29 +180,18 @@ current promise, you have to "rethrow" the error by returning a rejection constr
}
return $q.reject(reason);
});
</pre><h4 id="Parameters">Parameters</h4>
<ul class="parameters"><li><code ng:non-bindable="">reason {*} </code>
<p>Constant, message, exception or an object representing the rejection reason.</p></li>
</ul>
<h4 id="Returns">Returns</h4>
<div class="returns"><code ng:non-bindable="">{Promise}</code>
<p>Returns a promise that was already resolved as rejected with the <code>reason</code>.</p></div>
</div>
</pre>
</div><h5 id="parameters">Parameters</h5><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>reason</td><td><a href="" class="label type-hint type-hint-object">*</a></td><td><div class="ng-q-reject-page"><p>Constant, message, exception or an object representing the rejection reason.</p>
</div></td></tr></tbody></table><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-promise">Promise</a></td><td><div class="ng-q-reject-page"><p>Returns a promise that was already resolved as rejected with the <code>reason</code>.</p>
</div></td></tr></table></div>
</li>
<li><h3 id="when">when(value)</h3>
<div class="when"><p>Wraps an object that might be a value or a (3rd party) then-able promise into a $q promise.
<div class="when"><div class="ng-q-when-page"><p>Wraps an object that might be a value or a (3rd party) then-able promise into a $q promise.
This is useful when you are dealing with an object that might or might not be a promise, or if
the promise comes from a source that can't be trusted.</p><h4 id="Parameters">Parameters</h4>
<ul class="parameters"><li><code ng:non-bindable="">value {*} </code>
<p>Value or a promise</p></li>
</ul>
<h4 id="Returns">Returns</h4>
<div class="returns"><code ng:non-bindable="">{Promise}</code>
<p>Returns a single promise that will be resolved with an array of values,
each value corresponding to the promise at the same index in the <code>promises</code> array. If any of
the promises is resolved with a rejection, this resulting promise will be resolved with the
same rejection.</p></div>
</div>
the promise comes from a source that can&#39;t be trusted.</p>
</div><h5 id="parameters">Parameters</h5><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>value</td><td><a href="" class="label type-hint type-hint-object">*</a></td><td><div class="ng-q-when-page"><p>Value or a promise</p>
</div></td></tr></tbody></table><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-promise">Promise</a></td><td><div class="ng-q-when-page"><p>Returns a promise of the passed value or promise</p>
</div></td></tr></table></div>
</li>
</ul>
</div>

12
lib/angular/docs/partials/api/ng.$rootElement.html Normal file → Executable file
View file

@ -1,8 +1,10 @@
<h1><code ng:non-bindable="">$rootElement</code>
<span class="hint">(service in module <code ng:non-bindable="">ng</code>
)</span>
<a href="http://github.com/angular/angular.js/tree/v1.2.0rc1/src/ng/rootElement.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/rootElement.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">$rootElement</code>
<div><span class="hint">service in module <code ng:non-bindable="">ng</code>
</span>
</div>
</h1>
<div><a href="http://github.com/angular/angular.js/edit/master/src/ng/rootElement.js" class="improve-docs btn btn-primary">Improve this doc</a><p>The root element of Angular application. This is either the element where <a href="api/ng.directive:ngApp"><code>ngApp</code></a> was declared or the element passed into
<div><div class="ng-rootelement-page"><p>The root element of Angular application. This is either the element where <a href="api/ng.directive:ngApp"><code>ngApp</code></a> was declared or the element passed into
<a href="api/angular.bootstrap"><code>angular.bootstrap</code></a>. The element represent the root element of application. It is also the
location where the applications <a href="api/AUTO.$injector"><code>$injector</code></a> service gets
published, it can be retrieved using <code>$rootElement.injector()</code>.</p></div>
published, it can be retrieved using <code>$rootElement.injector()</code>.</p>
</div></div>

258
lib/angular/docs/partials/api/ng.$rootScope.Scope.html Normal file → Executable file
View file

@ -1,13 +1,13 @@
<h1><code ng:non-bindable="">Scope</code>
<span class="hint">(type in module <code ng:non-bindable="">ng</code>
)</span>
<a href="http://github.com/angular/angular.js/tree/v1.2.0rc1/src/ng/rootScope.js#L75" 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/rootScope.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">Scope</code>
<div><span class="hint">type in module <code ng:non-bindable="">ng</code>
</span>
</div>
</h1>
<div><a href="http://github.com/angular/angular.js/edit/master/src/ng/rootScope.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p>A root scope can be retrieved using the <a href="api/ng.$rootScope"><code>$rootScope</code></a> key from the
<div><h2 id="Description">Description</h2>
<div class="description"><div class="ng-rootscope-scope-page"><p>A root scope can be retrieved using the <a href="api/ng.$rootScope"><code>$rootScope</code></a> key from the
<a href="api/AUTO.$injector"><code>$injector</code></a>. Child scopes are created using the
<a href="api/ng.$rootScope.Scope#$new"><code>$new()</code></a> method. (Most scopes are created automatically when
compiled HTML template is executed.)</p>
<p>Here is a simple scope snippet to show how you can interact with the scope.
<pre class="prettyprint linenums">
@ -30,9 +30,7 @@ compiled HTML template is executed.)</p>
expect(scope.greeting).toEqual('Hello Misko!');
</pre>
<h3>Inheritance</h3>
<p>A scope can inherit from a parent scope, as in this example:
<pre class="prettyprint linenums">
var parent = $rootScope;
@ -45,34 +43,26 @@ compiled HTML template is executed.)</p>
child.salutation = "Welcome";
expect(child.salutation).toEqual('Welcome');
expect(parent.salutation).toEqual('Hello');
</pre></div>
</pre>
</div></div>
<h2 id="Usage">Usage</h2>
<div class="usage"><pre class="prettyprint linenums">Scope([providers][, instanceCache]);</pre>
<h3 id="Parameters">Parameters</h3>
<ul class="parameters"><li><code ng:non-bindable="">providers<i>(optional)</i> {Object.&lt;string, function()&gt;=} </code>
<p>Map of service factory which need to be provided
for the current scope. Defaults to <a href="api/ng">ng</a>.</p></li>
<li><code ng:non-bindable="">instanceCache<i>(optional)</i> {Object.&lt;string, *&gt;=} </code>
<p>Provides pre-instantiated services which should
<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>providers <div><em>(optional)</em></div></td><td><a href="" class="label type-hint type-hint-object">Object.&lt;string, function()&gt;</a></td><td><div class="ng-rootscope-scope-page"><p>Map of service factory which need to be provided
for the current scope. Defaults to <a href="api/ng">ng</a>.</p>
</div></td></tr><tr><td>instanceCache <div><em>(optional)</em></div></td><td><a href="" class="label type-hint type-hint-object">Object.&lt;string, *&gt;</a></td><td><div class="ng-rootscope-scope-page"><p>Provides pre-instantiated services which should
append/override services provided by <code>providers</code>. This is handy when unit-testing and having
the need to override a default service.</p></li>
</ul>
<h3 id="Returns">Returns</h3>
<div class="returns"><code ng:non-bindable="">{Object}</code>
<p>Newly created scope.</p></div>
</div>
the need to override a default service.</p>
</div></td></tr></tbody></table><h4 id="returns">Returns</h4><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-object">Object</a></td><td><div class="ng-rootscope-scope-page"><p>Newly created scope.</p>
</div></td></tr></table></div>
<div class="member method"><h2 id="Methods">Methods</h2>
<ul class="methods"><li><h3 id="$apply">$apply(exp)</h3>
<div class="$apply"><p><code>$apply()</code> is used to execute an expression in angular from outside of the angular framework.
<div class="$apply"><div class="ng-rootscope-scope-apply-page"><p><code>$apply()</code> is used to execute an expression in angular from outside of the angular framework.
(For example from browser DOM events, setTimeout, XHR or third party libraries).
Because we are calling into the angular framework we need to perform proper scope life-cycle
of <a href="api/ng.$exceptionHandler"><code>exception handling</code></a>,
<a href="api/ng.$rootScope.Scope#$digest"><code>executing watches</code></a>.</p>
<h5>Life cycle</h5>
<h4>Pseudo-Code of <code>$apply()</code></h4>
<pre class="prettyprint linenums">
function $apply(expr) {
try {
@ -84,9 +74,7 @@ of <a href="api/ng.$exceptionHandler"><code>exception handling</code></a>,
}
}
</pre>
<p>Scope's <code>$apply()</code> method transitions through the following stages:</p>
<p>Scope&#39;s <code>$apply()</code> method transitions through the following stages:</p>
<ol>
<li>The <a href="guide/expression">expression</a> is executed using the
<a href="api/ng.$rootScope.Scope#$eval"><code>$eval()</code></a> method.</li>
@ -94,77 +82,61 @@ of <a href="api/ng.$exceptionHandler"><code>exception handling</code></a>,
<a href="api/ng.$exceptionHandler"><code>$exceptionHandler</code></a> service.</li>
<li>The <a href="api/ng.$rootScope.Scope#$watch"><code>watch</code></a> listeners are fired immediately after the expression
was executed using the <a href="api/ng.$rootScope.Scope#$digest"><code>$digest()</code></a> method.</li>
</ol><h4 id="Parameters">Parameters</h4>
<ul class="parameters"><li><code ng:non-bindable="">exp<i>(optional)</i> {(string|function())=} </code>
<p>An angular expression to be executed.</p>
</ol>
</div><h5 id="parameters">Parameters</h5><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>exp <div><em>(optional)</em></div></td><td><a href="" class="label type-hint type-hint-string">string</a><a href="" class="label type-hint type-hint-function">function()</a></td><td><div class="ng-rootscope-scope-apply-page"><p>An angular expression to be executed.</p>
<ul>
<li><code>string</code>: execute using the rules as defined in <a href="guide/expression">expression</a>.</li>
<li><code>function(scope)</code>: execute the function with current <code>scope</code> parameter.</li>
</ul></li>
</ul>
<h4 id="Returns">Returns</h4>
<div class="returns"><code ng:non-bindable="">{*}</code>
<p>The result of evaluating the expression.</p></div>
</div>
</div></td></tr></tbody></table><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-object">*</a></td><td><div class="ng-rootscope-scope-apply-page"><p>The result of evaluating the expression.</p>
</div></td></tr></table></div>
</li>
<li><h3 id="$broadcast">$broadcast(name, args)</h3>
<div class="$broadcast"><p>Dispatches an event <code>name</code> downwards to all child scopes (and their children) notifying the
<div class="$broadcast"><div class="ng-rootscope-scope-broadcast-page"><p>Dispatches an event <code>name</code> downwards to all child scopes (and their children) notifying the
registered <a href="api/ng.$rootScope.Scope#$on"><code>ng.$rootScope.Scope#$on</code></a> listeners.</p>
<p>The event life cycle starts at the scope on which <code>$broadcast</code> was called. All
<a href="api/ng.$rootScope.Scope#$on"><code>listeners</code></a> listening for <code>name</code> event on this scope get notified.
Afterwards, the event propagates to all direct and indirect scopes of the current scope and
calls all registered listeners along the way. The event cannot be canceled.</p>
<p>Any exception emitted from the <a href="api/ng.$rootScope.Scope#$on"><code>listeners</code></a> will be passed
onto the <a href="api/ng.$exceptionHandler"><code>$exceptionHandler</code></a> service.</p><h4 id="Parameters">Parameters</h4>
<ul class="parameters"><li><code ng:non-bindable="">name {string} </code>
<p>Event name to emit.</p></li>
<li><code ng:non-bindable="">args {...*} </code>
<p>Optional set of arguments which will be passed onto the event listeners.</p></li>
</ul>
<h4 id="Returns">Returns</h4>
<div class="returns"><code ng:non-bindable="">{Object}</code>
<p>Event object, see <a href="api/ng.$rootScope.Scope#$on"><code>ng.$rootScope.Scope#$on</code></a></p></div>
</div>
onto the <a href="api/ng.$exceptionHandler"><code>$exceptionHandler</code></a> service.</p>
</div><h5 id="parameters">Parameters</h5><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>name</td><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="ng-rootscope-scope-broadcast-page"><p>Event name to broadcast.</p>
</div></td></tr><tr><td>args</td><td><a href="" class="label type-hint type-hint-object">...*</a></td><td><div class="ng-rootscope-scope-broadcast-page"><p>Optional set of arguments which will be passed onto the event listeners.</p>
</div></td></tr></tbody></table><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-object">Object</a></td><td><div class="ng-rootscope-scope-broadcast-page"><p>Event object, see <a href="api/ng.$rootScope.Scope#$on"><code>ng.$rootScope.Scope#$on</code></a></p>
</div></td></tr></table></div>
</li>
<li><h3 id="$destroy">$destroy()</h3>
<div class="$destroy"><p>Removes the current scope (and all of its children) from the parent scope. Removal implies
<div class="$destroy"><div class="ng-rootscope-scope-destroy-page"><p>Removes the current scope (and all of its children) from the parent scope. Removal implies
that calls to <a href="api/ng.$rootScope.Scope#$digest"><code>$digest()</code></a> will no longer
propagate to the current scope and its children. Removal also implies that the current
scope is eligible for garbage collection.</p>
<p>The <code>$destroy()</code> is usually used by directives such as
<a href="api/ng.directive:ngRepeat"><code>ngRepeat</code></a> for managing the
unrolling of the loop.</p>
<p>Just before a scope is destroyed a <code>$destroy</code> event is broadcasted on this scope.
Application code can register a <code>$destroy</code> event handler that will give it chance to
perform any necessary cleanup.</p></div>
perform any necessary cleanup.</p>
<p>Note that, in AngularJS, there is also a <code>$destroy</code> jQuery event, which can be used to
clean up DOM bindings before an element is removed from the DOM.</p>
</div></div>
</li>
<li><h3 id="$digest">$digest()</h3>
<div class="$digest"><p>Process all of the <a href="api/ng.$rootScope.Scope#$watch"><code>watchers</code></a> of the current scope and its children.
Because a <a href="api/ng.$rootScope.Scope#$watch"><code>watcher</code></a>'s listener can change the model, the
<div class="$digest"><div class="ng-rootscope-scope-digest-page"><p>Processes all of the <a href="api/ng.$rootScope.Scope#$watch"><code>watchers</code></a> of the current scope and its children.
Because a <a href="api/ng.$rootScope.Scope#$watch"><code>watcher</code></a>&#39;s listener can change the model, the
<code>$digest()</code> keeps calling the <a href="api/ng.$rootScope.Scope#$watch"><code>watchers</code></a> until no more listeners are
firing. This means that it is possible to get into an infinite loop. This function will throw
<code>'Maximum iteration limit exceeded.'</code> if the number of iterations exceeds 10.</p>
<p>Usually you don't call <code>$digest()</code> directly in
<code>&#39;Maximum iteration limit exceeded.&#39;</code> if the number of iterations exceeds 10.</p>
<p>Usually you don&#39;t call <code>$digest()</code> directly in
<a href="api/ng.directive:ngController"><code>controllers</code></a> or in
<a href="api/ng.$compileProvider#directive"><code>directives</code></a>.
Instead a call to <a href="api/ng.$rootScope.Scope#$apply"><code>$apply()</code></a> (typically from within a
<a href="api/ng.$compileProvider#directive"><code>directives</code></a>) will force a <code>$digest()</code>.</p>
<p>If you want to be notified whenever <code>$digest()</code> is called,
you can register a <code>watchExpression</code> function with <a href="api/ng.$rootScope.Scope#$watch"><code>$watch()</code></a>
with no <code>listener</code>.</p>
<p>You may have a need to call <code>$digest()</code> from within unit-tests, to simulate the scope
life-cycle.</p>
<h4>Example</h4>
<pre class="prettyprint linenums">
var scope = ...;
scope.name = 'misko';
@ -183,35 +155,27 @@ life-cycle.</p>
scope.name = 'adam';
scope.$digest();
expect(scope.counter).toEqual(1);
</pre></div>
</pre>
</div></div>
</li>
<li><h3 id="$emit">$emit(name, args)</h3>
<div class="$emit"><p>Dispatches an event <code>name</code> upwards through the scope hierarchy notifying the
<div class="$emit"><div class="ng-rootscope-scope-emit-page"><p>Dispatches an event <code>name</code> upwards through the scope hierarchy notifying the
registered <a href="api/ng.$rootScope.Scope#$on"><code>ng.$rootScope.Scope#$on</code></a> listeners.</p>
<p>The event life cycle starts at the scope on which <code>$emit</code> was called. All
<a href="api/ng.$rootScope.Scope#$on"><code>listeners</code></a> listening for <code>name</code> event on this scope get notified.
Afterwards, the event traverses upwards toward the root scope and calls all registered
listeners along the way. The event will stop propagating if one of the listeners cancels it.</p>
<p>Any exception emmited from the <a href="api/ng.$rootScope.Scope#$on"><code>listeners</code></a> will be passed
onto the <a href="api/ng.$exceptionHandler"><code>$exceptionHandler</code></a> service.</p><h4 id="Parameters">Parameters</h4>
<ul class="parameters"><li><code ng:non-bindable="">name {string} </code>
<p>Event name to emit.</p></li>
<li><code ng:non-bindable="">args {...*} </code>
<p>Optional set of arguments which will be passed onto the event listeners.</p></li>
</ul>
<h4 id="Returns">Returns</h4>
<div class="returns"><code ng:non-bindable="">{Object}</code>
<p>Event object, see <a href="api/ng.$rootScope.Scope#$on"><code>ng.$rootScope.Scope#$on</code></a></p></div>
</div>
<p>Any exception emitted from the <a href="api/ng.$rootScope.Scope#$on"><code>listeners</code></a> will be passed
onto the <a href="api/ng.$exceptionHandler"><code>$exceptionHandler</code></a> service.</p>
</div><h5 id="parameters">Parameters</h5><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>name</td><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="ng-rootscope-scope-emit-page"><p>Event name to emit.</p>
</div></td></tr><tr><td>args</td><td><a href="" class="label type-hint type-hint-object">...*</a></td><td><div class="ng-rootscope-scope-emit-page"><p>Optional set of arguments which will be passed onto the event listeners.</p>
</div></td></tr></tbody></table><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-object">Object</a></td><td><div class="ng-rootscope-scope-emit-page"><p>Event object, see <a href="api/ng.$rootScope.Scope#$on"><code>ng.$rootScope.Scope#$on</code></a></p>
</div></td></tr></table></div>
</li>
<li><h3 id="$eval">$eval(expression)</h3>
<div class="$eval"><p>Executes the <code>expression</code> on the current scope returning the result. Any exceptions in the
<div class="$eval"><div class="ng-rootscope-scope-eval-page"><p>Executes the <code>expression</code> on the current scope returning the result. Any exceptions in the
expression are propagated (uncaught). This is useful when evaluating Angular expressions.</p>
<h4>Example</h4>
<pre class="prettyprint linenums">
var scope = ng.$rootScope.Scope();
scope.a = 1;
@ -219,71 +183,52 @@ expression are propagated (uncaught). This is useful when evaluating Angular exp
expect(scope.$eval('a+b')).toEqual(3);
expect(scope.$eval(function(scope){ return scope.a + scope.b; })).toEqual(3);
</pre><h4 id="Parameters">Parameters</h4>
<ul class="parameters"><li><code ng:non-bindable="">expression<i>(optional)</i> {(string|function())=} </code>
<p>An angular expression to be executed.</p>
</pre>
</div><h5 id="parameters">Parameters</h5><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>expression <div><em>(optional)</em></div></td><td><a href="" class="label type-hint type-hint-string">string</a><a href="" class="label type-hint type-hint-function">function()</a></td><td><div class="ng-rootscope-scope-eval-page"><p>An angular expression to be executed.</p>
<ul>
<li><code>string</code>: execute using the rules as defined in <a href="guide/expression">expression</a>.</li>
<li><code>function(scope)</code>: execute the function with the current <code>scope</code> parameter.</li>
</ul></li>
</ul>
<h4 id="Returns">Returns</h4>
<div class="returns"><code ng:non-bindable="">{*}</code>
<p>The result of evaluating the expression.</p></div>
</div>
</div></td></tr></tbody></table><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-object">*</a></td><td><div class="ng-rootscope-scope-eval-page"><p>The result of evaluating the expression.</p>
</div></td></tr></table></div>
</li>
<li><h3 id="$evalAsync">$evalAsync(expression)</h3>
<div class="$evalasync"><p>Executes the expression on the current scope at a later point in time.</p>
<div class="$evalasync"><div class="ng-rootscope-scope-evalasync-page"><p>Executes the expression on the current scope at a later point in time.</p>
<p>The <code>$evalAsync</code> makes no guarantees as to when the <code>expression</code> will be executed, only that:</p>
<ul>
<li>it will execute in the current script execution context (before any DOM rendering).</li>
<li>at least one <a href="api/ng.$rootScope.Scope#$digest"><code>$digest cycle</code></a> will be performed after
<code>expression</code> execution.</li>
</ul>
<p>Any exceptions from the execution of the expression are forwarded to the
<a href="api/ng.$exceptionHandler"><code>$exceptionHandler</code></a> service.</p><h4 id="Parameters">Parameters</h4>
<ul class="parameters"><li><code ng:non-bindable="">expression<i>(optional)</i> {(string|function())=} </code>
<p>An angular expression to be executed.</p>
<a href="api/ng.$exceptionHandler"><code>$exceptionHandler</code></a> service.</p>
</div><h5 id="parameters">Parameters</h5><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>expression <div><em>(optional)</em></div></td><td><a href="" class="label type-hint type-hint-string">string</a><a href="" class="label type-hint type-hint-function">function()</a></td><td><div class="ng-rootscope-scope-evalasync-page"><p>An angular expression to be executed.</p>
<ul>
<li><code>string</code>: execute using the rules as defined in <a href="guide/expression">expression</a>.</li>
<li><code>function(scope)</code>: execute the function with the current <code>scope</code> parameter.</li>
</ul></li>
</ul>
</div>
</div></td></tr></tbody></table></div>
</li>
<li><h3 id="$new">$new(isolate)</h3>
<div class="$new"><p>Creates a new child <a href="api/ng.$rootScope.Scope"><code>scope</code></a>.</p>
<div class="$new"><div class="ng-rootscope-scope-new-page"><p>Creates a new child <a href="api/ng.$rootScope.Scope"><code>scope</code></a>.</p>
<p>The parent scope will propagate the <a href="api/ng.$rootScope.Scope#$digest"><code>$digest()</code></a> and
<a href="api/ng.$rootScope.Scope#$digest"><code>$digest()</code></a> events. The scope can be removed from the scope
hierarchy using <a href="api/ng.$rootScope.Scope#$destroy"><code>$destroy()</code></a>.</p>
<p><a href="api/ng.$rootScope.Scope#$destroy"><code>$destroy()</code></a> must be called on a scope when it is desired for
the scope and its child scopes to be permanently detached from the parent and thus stop
participating in model change detection and listener notification by invoking.</p><h4 id="Parameters">Parameters</h4>
<ul class="parameters"><li><code ng:non-bindable="">isolate {boolean} </code>
<p>if true then the scope does not prototypically inherit from the
participating in model change detection and listener notification by invoking.</p>
</div><h5 id="parameters">Parameters</h5><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>isolate</td><td><a href="" class="label type-hint type-hint-boolean">boolean</a></td><td><div class="ng-rootscope-scope-new-page"><p>if true then the scope does not prototypically inherit from the
parent scope. The scope is isolated, as it can not see parent scope properties.
When creating widgets it is useful for the widget to not accidentally read parent
state.</p></li>
</ul>
<h4 id="Returns">Returns</h4>
<div class="returns"><code ng:non-bindable="">{Object}</code>
<p>The newly created child scope.</p></div>
</div>
state.</p>
</div></td></tr></tbody></table><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-object">Object</a></td><td><div class="ng-rootscope-scope-new-page"><p>The newly created child scope.</p>
</div></td></tr></table></div>
</li>
<li><h3 id="$on">$on(name, listener)</h3>
<div class="$on"><p>Listens on events of a given type. See <a href="api/ng.$rootScope.Scope#$emit"><code>$emit</code></a> for discussion of
<div class="$on"><div class="ng-rootscope-scope-on-page"><p>Listens on events of a given type. See <a href="api/ng.$rootScope.Scope#$emit"><code>$emit</code></a> for discussion of
event life cycle.</p>
<p>The event listener function format is: <code>function(event, args...)</code>. The <code>event</code> object
passed into the listener has the following attributes:</p>
<ul>
<li><code>targetScope</code> - <code>{Scope}</code>: the scope on which the event was <code>$emit</code>-ed or <code>$broadcast</code>-ed.</li>
<li><code>currentScope</code> - <code>{Scope}</code>: the current scope which is handling the event.</li>
@ -292,20 +237,14 @@ passed into the listener has the following attributes:</p>
propagation (available only for events that were <code>$emit</code>-ed).</li>
<li><code>preventDefault</code> - <code>{function}</code>: calling <code>preventDefault</code> sets <code>defaultPrevented</code> flag to true.</li>
<li><code>defaultPrevented</code> - <code>{boolean}</code>: true if <code>preventDefault</code> was called.</li>
</ul><h4 id="Parameters">Parameters</h4>
<ul class="parameters"><li><code ng:non-bindable="">name {string} </code>
<p>Event name to listen on.</p></li>
<li><code ng:non-bindable="">listener {function(event, args...)} </code>
<p>Function to call when the event is emitted.</p></li>
</ul>
<h4 id="Returns">Returns</h4>
<div class="returns"><code ng:non-bindable="">{function()}</code>
<p>Returns a deregistration function for this listener.</p></div>
</div>
</div><h5 id="parameters">Parameters</h5><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>name</td><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="ng-rootscope-scope-on-page"><p>Event name to listen on.</p>
</div></td></tr><tr><td>listener</td><td><a href="" class="label type-hint type-hint-function">function(event, args...</a></td><td><div class="ng-rootscope-scope-on-page"><p>Function to call when the event is emitted.</p>
</div></td></tr></tbody></table><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-function">function()</a></td><td><div class="ng-rootscope-scope-on-page"><p>Returns a deregistration function for this listener.</p>
</div></td></tr></table></div>
</li>
<li><h3 id="$watch">$watch(watchExpression, listener, objectEquality)</h3>
<div class="$watch"><p>Registers a <code>listener</code> callback to be executed whenever the <code>watchExpression</code> changes.</p>
<div class="$watch"><div class="ng-rootscope-scope-watch-page"><p>Registers a <code>listener</code> callback to be executed whenever the <code>watchExpression</code> changes.</p>
<ul>
<li>The <code>watchExpression</code> is called on every call to <a href="api/ng.$rootScope.Scope#$digest"><code>$digest()</code></a> and
should return the value which will be watched. (Since <a href="api/ng.$rootScope.Scope#$digest"><code>$digest()</code></a>
@ -321,21 +260,17 @@ have adverse memory and performance implications.</li>
is achieved by rerunning the watchers until no changes are detected. The rerun iteration
limit is 10 to prevent an infinite loop deadlock.</li>
</ul>
<p>If you want to be notified whenever <a href="api/ng.$rootScope.Scope#$digest"><code>$digest</code></a> is called,
you can register a <code>watchExpression</code> function with no <code>listener</code>. (Since <code>watchExpression</code>
can execute multiple times per <a href="api/ng.$rootScope.Scope#$digest"><code>$digest</code></a> cycle when a change is
detected, be prepared for multiple calls to your listener.)</p>
<p>After a watcher is registered with the scope, the <code>listener</code> fn is called asynchronously
(via <a href="api/ng.$rootScope.Scope#$evalAsync"><code>$evalAsync</code></a>) to initialize the
watcher. In rare cases, this is undesirable because the listener is called when the result
of <code>watchExpression</code> didn't change. To detect this scenario within the <code>listener</code> fn, you
of <code>watchExpression</code> didn&#39;t change. To detect this scenario within the <code>listener</code> fn, you
can compare the <code>newVal</code> and <code>oldVal</code>. If these two values are identical (<code>===</code>) then the
listener was called due to initialization.</p>
<h4>Example</h4>
<pre class="prettyprint linenums">
// let's assume that scope was dependency injected as the $rootScope
var scope = $rootScope;
@ -353,46 +288,35 @@ listener was called due to initialization.</p>
scope.name = 'adam';
scope.$digest();
expect(scope.counter).toEqual(1);
</pre><h4 id="Parameters">Parameters</h4>
<ul class="parameters"><li><code ng:non-bindable="">watchExpression {(function()|string)} </code>
<p>Expression that is evaluated on each
</pre>
</div><h5 id="parameters">Parameters</h5><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>watchExpression</td><td><a href="" class="label type-hint type-hint-function">function()</a><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="ng-rootscope-scope-watch-page"><p>Expression that is evaluated on each
<a href="api/ng.$rootScope.Scope#$digest"><code>$digest</code></a> cycle. A change in the return value triggers a
call to the <code>listener</code>.</p>
<ul>
<li><code>string</code>: Evaluated as <a href="guide/expression">expression</a></li>
<li><code>function(scope)</code>: called with current <code>scope</code> as a parameter.</li>
</ul></li>
<li><code ng:non-bindable="">listener<i>(optional)</i> {(function()|string)=} </code>
<p>Callback called whenever the return value of
</ul>
</div></td></tr><tr><td>listener <div><em>(optional)</em></div></td><td><a href="" class="label type-hint type-hint-function">function()</a><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="ng-rootscope-scope-watch-page"><p>Callback called whenever the return value of
the <code>watchExpression</code> changes.</p>
<ul>
<li><code>string</code>: Evaluated as <a href="guide/expression">expression</a></li>
<li><code>function(newValue, oldValue, scope)</code>: called with current and previous values as parameters.</li>
</ul></li>
<li><code ng:non-bindable="">objectEquality<i>(optional)</i> {boolean=} </code>
<p>Compare object for equality rather than for reference.</p></li>
</ul>
<h4 id="Returns">Returns</h4>
<div class="returns"><code ng:non-bindable="">{function()}</code>
<p>Returns a deregistration function for this listener.</p></div>
</div>
</div></td></tr><tr><td>objectEquality <div><em>(optional)</em></div></td><td><a href="" class="label type-hint type-hint-boolean">boolean</a></td><td><div class="ng-rootscope-scope-watch-page"><p>Compare object for equality rather than for reference.</p>
</div></td></tr></tbody></table><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-function">function()</a></td><td><div class="ng-rootscope-scope-watch-page"><p>Returns a deregistration function for this listener.</p>
</div></td></tr></table></div>
</li>
<li><h3 id="$watchCollection">$watchCollection(obj, listener)</h3>
<div class="$watchcollection"><p>Shallow watches the properties of an object and fires whenever any of the properties change
<div class="$watchcollection"><div class="ng-rootscope-scope-watchcollection-page"><p>Shallow watches the properties of an object and fires whenever any of the properties change
(for arrays this implies watching the array items, for object maps this implies watching the properties).
If a change is detected the <code>listener</code> callback is fired.</p>
<ul>
<li>The <code>obj</code> collection is observed via standard $watch operation and is examined on every call to $digest() to
see if any items have been added, removed, or moved.</li>
<li>The <code>listener</code> is called whenever anything within the <code>obj</code> has changed. Examples include adding new items
into the object or array, removing and moving items around.</li>
</ul>
<h4>Example</h4>
<pre class="prettyprint linenums">
$scope.names = ['igor', 'matias', 'misko', 'james'];
$scope.dataCount = 4;
@ -412,40 +336,36 @@ into the object or array, removing and moving items around.</li>
//now there's been a change
expect($scope.dataCount).toEqual(3);
</pre><h4 id="Parameters">Parameters</h4>
<ul class="parameters"><li><code ng:non-bindable="">obj {string|Function(scope)} </code>
<p>Evaluated as <a href="guide/expression">expression</a>. The expression value
</pre>
</div><h5 id="parameters">Parameters</h5><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>obj</td><td><a href="" class="label type-hint type-hint-string">string</a><a href="" class="label type-hint type-hint-function">Function(scope</a></td><td><div class="ng-rootscope-scope-watchcollection-page"><p>Evaluated as <a href="guide/expression">expression</a>. The expression value
should evaluate to an object or an array which is observed on each
<a href="api/ng.$rootScope.Scope#$digest"><code>$digest</code></a> cycle. Any shallow change within the collection will trigger
a call to the <code>listener</code>.</p></li>
<li><code ng:non-bindable="">listener {function(newCollection, oldCollection, scope)} </code>
<p>a callback function that is fired with both
a call to the <code>listener</code>.</p>
</div></td></tr><tr><td>listener</td><td><a href="" class="label type-hint type-hint-function">function(newCollection, oldCollection, scope</a></td><td><div class="ng-rootscope-scope-watchcollection-page"><p>a callback function that is fired with both
the <code>newCollection</code> and <code>oldCollection</code> as parameters.
The <code>newCollection</code> object is the newly modified data obtained from the <code>obj</code> expression and the
<code>oldCollection</code> object is a copy of the former collection data.
The <code>scope</code> refers to the current scope.</p></li>
</ul>
<h4 id="Returns">Returns</h4>
<div class="returns"><code ng:non-bindable="">{function()}</code>
<p>Returns a de-registration function for this listener. When the de-registration function is executed
then the internal watch operation is terminated.</p></div>
</div>
The <code>scope</code> refers to the current scope.</p>
</div></td></tr></tbody></table><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-function">function()</a></td><td><div class="ng-rootscope-scope-watchcollection-page"><p>Returns a de-registration function for this listener. When the de-registration function is executed
then the internal watch operation is terminated.</p>
</div></td></tr></table></div>
</li>
</ul>
</div>
<div class="member property"><h2 id="Properties">Properties</h2>
<ul class="properties"><li><h3 id="$id">$id</h3>
<div class="$id"><h4 id="Returns">Returns</h4>
<div class="returns"><code ng:non-bindable="">{number}</code>
<p>Unique scope ID (monotonically increasing alphanumeric sequence) useful for
debugging.</p></div>
</div>
<div class="$id"><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-number">number</a></td><td><div class="ng-rootscope-scope-id-page"><p>Unique scope ID (monotonically increasing alphanumeric sequence) useful for
debugging.</p>
</div></td></tr></table></div>
</li>
</ul>
</div>
<div class="member event"><h2 id="Events">Events</h2>
<ul class="events"><li><h3 id="$destroy">$destroy</h3>
<div class="$destroy"><p>Broadcasted when a scope and its children are being destroyed.</p><div class="inline"><h4 id="Type.">Type:</h4>
<div class="$destroy"><div class="ng-rootscope-scope-destroy-page"><p>Broadcasted when a scope and its children are being destroyed.</p>
<p>Note that, in AngularJS, there is also a <code>$destroy</code> jQuery event, which can be used to
clean up DOM bindings before an element is removed from the DOM.</p>
</div><div class="inline"><h4 id="Type.">Type:</h4>
<div class="type-">broadcast</div>
</div>
<div class="inline"><h4 id="Target.">Target:</h4>

18
lib/angular/docs/partials/api/ng.$rootScope.html Normal file → Executable file
View file

@ -1,9 +1,11 @@
<h1><code ng:non-bindable="">$rootScope</code>
<span class="hint">(service in module <code ng:non-bindable="">ng</code>
)</span>
</h1>
<div><a href="http://github.com/angular/angular.js/edit/master/src/ng/rootScope.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p>Every application has a single root <a href="api/ng.$rootScope.Scope"><code>scope</code></a>.
All other scopes are child scopes of the root scope. Scopes provide mechanism for watching the model and provide
event processing life-cycle. See <a href="guide/scope">developer guide on scopes</a>.</p></div>
<a href="http://github.com/angular/angular.js/tree/v1.2.0rc1/src/ng/rootScope.js#L52" 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/rootScope.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">$rootScope</code>
<div><span class="hint">service in module <code ng:non-bindable="">ng</code>
</span>
</div>
</h1>
<div><h2 id="Description">Description</h2>
<div class="description"><div class="ng-rootscope-page"><p>Every application has a single root <a href="api/ng.$rootScope.Scope"><code>scope</code></a>.
All other scopes are child scopes of the root scope. Scopes provide mechanism for watching the model and provide
event processing life-cycle. See <a href="guide/scope">developer guide on scopes</a>.</p>
</div></div>
</div>

View file

@ -1,19 +1,18 @@
<h1><code ng:non-bindable="">$rootScopeProvider</code>
<span class="hint">(service in module <code ng:non-bindable="">ng</code>
)</span>
<a href="http://github.com/angular/angular.js/tree/v1.2.0rc1/src/ng/rootScope.js#L29" 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/rootScope.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">$rootScopeProvider</code>
<div><span class="hint">service in module <code ng:non-bindable="">ng</code>
</span>
</div>
</h1>
<div><a href="http://github.com/angular/angular.js/edit/master/src/ng/rootScope.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p>Provider for the $rootScope service.</p></div>
<div><h2 id="Description">Description</h2>
<div class="description"><div class="ng-rootscopeprovider-page"><p>Provider for the $rootScope service.</p>
</div></div>
<div class="member method"><h2 id="Methods">Methods</h2>
<ul class="methods"><li><h3 id="digestTtl">digestTtl(limit)</h3>
<div class="digestttl"><p>Sets the number of digest iteration the scope should attempt to execute before giving up and
<div class="digestttl"><div class="ng-rootscopeprovider-digestttl-page"><p>Sets the number of digest iterations the scope should attempt to execute before giving up and
assuming that the model is unstable.</p>
<p>The current default is 10 iterations.</p><h4 id="Parameters">Parameters</h4>
<ul class="parameters"><li><code ng:non-bindable="">limit {number} </code>
<p>The number of digest iterations.</p></li>
</ul>
</div>
<p>The current default is 10 iterations.</p>
</div><h5 id="parameters">Parameters</h5><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>limit</td><td><a href="" class="label type-hint type-hint-number">number</a></td><td><div class="ng-rootscopeprovider-digestttl-page"><p>The number of digest iterations.</p>
</div></td></tr></tbody></table></div>
</li>
</ul>
</div>

View file

@ -1,225 +0,0 @@
<h1><code ng:non-bindable="">$route</code>
<span class="hint">(service in module <code ng:non-bindable="">ng</code>
)</span>
</h1>
<div><a href="http://github.com/angular/angular.js/edit/master/src/ng/route.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p>Is used for deep-linking URLs to controllers and views (HTML partials).
It watches <code>$location.url()</code> and tries to map the path to an existing route definition.</p>
<p>You can define routes through <a href="api/ng.$routeProvider"><code>$routeProvider</code></a>'s API.</p>
<p>The <code>$route</code> service is typically used in conjunction with <a href="api/ng.directive:ngView"><code>ngView</code></a>
directive and the <a href="api/ng.$routeParams"><code>$routeParams</code></a> service.</p></div>
<h2 id="Dependencies">Dependencies</h2>
<ul class="dependencies"><li><code ng:non-bindable=""><a href="api/ng.$location">$location</a></code>
</li>
<li><code ng:non-bindable=""><a href="api/ng.$routeParams">$routeParams</a></code>
</li>
</ul>
<div class="member method"><h2 id="Methods">Methods</h2>
<ul class="methods"><li><h3 id="reload">reload()</h3>
<div class="reload"><p>Causes <code>$route</code> service to reload the current route even if
<a href="api/ng.$location"><code>$location</code></a> hasn't changed.</p>
<p>As a result of that, <a href="api/ng.directive:ngView"><code>ngView</code></a>
creates new scope, reinstantiates the controller.</p></div>
</li>
</ul>
</div>
<div class="member property"><h2 id="Properties">Properties</h2>
<ul class="properties"><li><h3 id="current">current</h3>
<div class="current"><p>Reference to the current route definition.
The route definition contains:</p>
<ul>
<li><code>controller</code>: The controller constructor as define in route definition.</li>
<li><p><code>locals</code>: A map of locals which is used by <a href="api/ng.$controller"><code>$controller</code></a> service for
controller instantiation. The <code>locals</code> contain
the resolved values of the <code>resolve</code> map. Additionally the <code>locals</code> also contain:</p>
<ul><li><code>$scope</code> - The current route scope.</li>
<li><code>$template</code> - The current route template HTML.</li></ul></li>
</ul></div>
</li>
<li><h3 id="routes">routes</h3>
<div class="routes"><p>Array of all configured routes.</p></div>
</li>
</ul>
</div>
<div class="member event"><h2 id="Events">Events</h2>
<ul class="events"><li><h3 id="$routeChangeError">$routeChangeError</h3>
<div class="$routechangeerror"><p>Broadcasted if any of the resolve promises are rejected.</p><div class="inline"><h4 id="Type.">Type:</h4>
<div class="type-">broadcast</div>
</div>
<div class="inline"><h4 id="Target.">Target:</h4>
<div class="target-">root scope</div>
</div>
<h4 id="Parameters">Parameters</h4>
<ul class="parameters"><li><code ng:non-bindable="">current {Route} </code>
<p>Current route information.</p></li>
<li><code ng:non-bindable="">previous {Route} </code>
<p>Previous route information.</p></li>
<li><code ng:non-bindable="">rejection {Route} </code>
<p>Rejection of the promise. Usually the error of the failed promise.</p></li>
</ul>
</div>
</li>
<li><h3 id="$routeChangeStart">$routeChangeStart</h3>
<div class="$routechangestart"><p>Broadcasted before a route change. At this point the route services starts
resolving all of the dependencies needed for the route change to occurs.
Typically this involves fetching the view template as well as any dependencies
defined in <code>resolve</code> route property. Once all of the dependencies are resolved
<code>$routeChangeSuccess</code> is fired.</p><div class="inline"><h4 id="Type.">Type:</h4>
<div class="type-">broadcast</div>
</div>
<div class="inline"><h4 id="Target.">Target:</h4>
<div class="target-">root scope</div>
</div>
<h4 id="Parameters">Parameters</h4>
<ul class="parameters"><li><code ng:non-bindable="">next {Route} </code>
<p>Future route information.</p></li>
<li><code ng:non-bindable="">current {Route} </code>
<p>Current route information.</p></li>
</ul>
</div>
</li>
<li><h3 id="$routeChangeSuccess">$routeChangeSuccess</h3>
<div class="$routechangesuccess"><p>Broadcasted after a route dependencies are resolved.
<a href="api/ng.directive:ngView"><code>ngView</code></a> listens for the directive
to instantiate the controller and render the view.</p><div class="inline"><h4 id="Type.">Type:</h4>
<div class="type-">broadcast</div>
</div>
<div class="inline"><h4 id="Target.">Target:</h4>
<div class="target-">root scope</div>
</div>
<h4 id="Parameters">Parameters</h4>
<ul class="parameters"><li><code ng:non-bindable="">angularEvent {Object} </code>
<p>Synthetic event object.</p></li>
<li><code ng:non-bindable="">current {Route} </code>
<p>Current route information.</p></li>
<li><code ng:non-bindable="">previous {Route|Undefined} </code>
<p>Previous route information, or undefined if current is first route entered.</p></li>
</ul>
</div>
</li>
<li><h3 id="$routeUpdate">$routeUpdate</h3>
<div class="$routeupdate"><p>The <code>reloadOnSearch</code> property has been set to false, and we are reusing the same
instance of the Controller.</p><div class="inline"><h4 id="Type.">Type:</h4>
<div class="type-">broadcast</div>
</div>
<div class="inline"><h4 id="Target.">Target:</h4>
<div class="target-">root scope</div>
</div>
</div>
</li>
</ul>
</div>
<h2 id="Example">Example</h2>
<div class="example"><p>This example shows how changing the URL hash causes the <code>$route</code> to match a route against the
URL, and the <code>ngView</code> pulls in the partial.</p>
<p>Note that this example is using <a href="api/ng.directive:script"><code>inlined templates</code></a>
to get it working on jsfiddle as well.</p>
<h4>Source</h4>
<div source-edit="ngView" source-edit-deps="angular.js script.js" source-edit-html="index.html-215 book.html chapter.html" source-edit-css="" source-edit-js="script.js-216" source-edit-unit="" source-edit-scenario="scenario.js-217"></div>
<div class="tabbable"><div class="tab-pane" title="index.html">
<pre class="prettyprint linenums" ng-set-text="index.html-215" ng-html-wrap="ngView angular.js script.js"></pre>
<script type="text/ng-template" id="index.html-215">
<div ng-controller="MainCntl">
Choose:
<a href="Book/Moby">Moby</a> |
<a href="Book/Moby/ch/1">Moby: Ch1</a> |
<a href="Book/Gatsby">Gatsby</a> |
<a href="Book/Gatsby/ch/4?key=value">Gatsby: Ch4</a> |
<a href="Book/Scarlet">Scarlet Letter</a><br/>
<div ng-view></div>
<hr />
<pre>$location.path() = {{$location.path()}}</pre>
<pre>$route.current.templateUrl = {{$route.current.templateUrl}}</pre>
<pre>$route.current.params = {{$route.current.params}}</pre>
<pre>$route.current.scope.name = {{$route.current.scope.name}}</pre>
<pre>$routeParams = {{$routeParams}}</pre>
</div>
</script>
</div>
<div class="tab-pane" title="book.html">
<pre class="prettyprint linenums" ng-set-text="book.html"></pre>
<script type="text/ng-template" id="book.html">
controller: {{name}}<br />
Book Id: {{params.bookId}}<br />
</script>
</div>
<div class="tab-pane" title="chapter.html">
<pre class="prettyprint linenums" ng-set-text="chapter.html"></pre>
<script type="text/ng-template" id="chapter.html">
controller: {{name}}<br />
Book Id: {{params.bookId}}<br />
Chapter Id: {{params.chapterId}}
</script>
</div>
<div class="tab-pane" title="script.js">
<pre class="prettyprint linenums" ng-set-text="script.js-216"></pre>
<script type="text/ng-template" id="script.js-216">
angular.module('ngView', [], function($routeProvider, $locationProvider) {
$routeProvider.when('/Book/:bookId', {
templateUrl: 'book.html',
controller: BookCntl,
resolve: {
// I will cause a 1 second delay
delay: function($q, $timeout) {
var delay = $q.defer();
$timeout(delay.resolve, 1000);
return delay.promise;
}
}
});
$routeProvider.when('/Book/:bookId/ch/:chapterId', {
templateUrl: 'chapter.html',
controller: ChapterCntl
});
// configure html5 to get links working on jsfiddle
$locationProvider.html5Mode(true);
});
function MainCntl($scope, $route, $routeParams, $location) {
$scope.$route = $route;
$scope.$location = $location;
$scope.$routeParams = $routeParams;
}
function BookCntl($scope, $routeParams) {
$scope.name = "BookCntl";
$scope.params = $routeParams;
}
function ChapterCntl($scope, $routeParams) {
$scope.name = "ChapterCntl";
$scope.params = $routeParams;
}
</script>
</div>
<div class="tab-pane" title="End to end test">
<pre class="prettyprint linenums" ng-set-text="scenario.js-217"></pre>
<script type="text/ng-template" id="scenario.js-217">
it('should load and compile correct template', function() {
element('a:contains("Moby: Ch1")').click();
var content = element('.doc-example-live [ng-view]').text();
expect(content).toMatch(/controller\: ChapterCntl/);
expect(content).toMatch(/Book Id\: Moby/);
expect(content).toMatch(/Chapter Id\: 1/);
element('a:contains("Scarlet")').click();
sleep(2); // promises are not part of scenario waiting
content = element('.doc-example-live [ng-view]').text();
expect(content).toMatch(/controller\: BookCntl/);
expect(content).toMatch(/Book Id\: Scarlet/);
});
</script>
</div>
</div><h4>Demo</h4>
<div class="well doc-example-live animator-container" ng-embed-app="ngView" ng-set-html="index.html-215" ng-eval-javascript="script.js-216"></div></div>
</div>

View file

@ -1,27 +0,0 @@
<h1><code ng:non-bindable="">$routeParams</code>
<span class="hint">(service in module <code ng:non-bindable="">ng</code>
)</span>
</h1>
<div><a href="http://github.com/angular/angular.js/edit/master/src/ng/routeParams.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p>Current set of route parameters. The route parameters are a combination of the
<a href="api/ng.$location"><code>$location</code></a> <code>search()</code>, and <code>path()</code>. The <code>path</code> parameters
are extracted when the <a href="api/ng.$route"><code>$route</code></a> path is matched.</p>
<p>In case of parameter name collision, <code>path</code> params take precedence over <code>search</code> params.</p>
<p>The service guarantees that the identity of the <code>$routeParams</code> object will remain unchanged
(but its properties will likely change) even when a route change occurs.</p></div>
<h2 id="Dependencies">Dependencies</h2>
<ul class="dependencies"><li><code ng:non-bindable=""><a href="api/ng.$route">$route</a></code>
</li>
</ul>
<h2 id="Example">Example</h2>
<div class="example"><pre class="prettyprint linenums">
// Given:
// URL: http://server.com/index.html#/Chapter/1/Section/2?search=moby
// Route: /Chapter/:chapterId/Section/:sectionId
//
// Then
$routeParams ==&gt; {chapterId:1, sectionId:2, search:'moby'}
</pre></div>
</div>

View file

@ -1,108 +0,0 @@
<h1><code ng:non-bindable="">$routeProvider</code>
<span class="hint">(service in module <code ng:non-bindable="">ng</code>
)</span>
</h1>
<div><a href="http://github.com/angular/angular.js/edit/master/src/ng/route.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p>Used for configuring routes. See <a href="api/ng.$route"><code>$route</code></a> for an example.</p></div>
<div class="member method"><h2 id="Methods">Methods</h2>
<ul class="methods"><li><h3 id="otherwise">otherwise(params)</h3>
<div class="otherwise"><p>Sets route definition that will be used on route change when no other route definition
is matched.</p><h4 id="Parameters">Parameters</h4>
<ul class="parameters"><li><code ng:non-bindable="">params {Object} </code>
<p>Mapping information to be assigned to <code>$route.current</code>.</p></li>
</ul>
<h4 id="Returns">Returns</h4>
<div class="returns"><code ng:non-bindable="">{Object}</code>
<p>self</p></div>
</div>
</li>
<li><h3 id="when">when(path, route)</h3>
<div class="when"><p>Adds a new route definition to the <code>$route</code> service.</p><h4 id="Parameters">Parameters</h4>
<ul class="parameters"><li><code ng:non-bindable="">path {string} </code>
<p>Route path (matched against <code>$location.path</code>). If <code>$location.path</code>
contains redundant trailing slash or is missing one, the route will still match and the
<code>$location.path</code> will be updated to add or drop the trailing slash to exactly match the
route definition.</p>
<ul>
<li><code>path</code> can contain named groups starting with a colon (<code>:name</code>). All characters up
to the next slash are matched and stored in <code>$routeParams</code> under the given <code>name</code>
when the route matches.</li>
<li><code>path</code> can contain named groups starting with a star (<code>*name</code>). All characters are
eagerly stored in <code>$routeParams</code> under the given <code>name</code> when the route matches.</li>
</ul>
<p>For example, routes like <code>/color/:color/largecode/*largecode/edit</code> will match
<code>/color/brown/largecode/code/with/slashs/edit</code> and extract:</p>
<ul>
<li><code>color: brown</code></li>
<li><code>largecode: code/with/slashs</code>.</li>
</ul></li>
<li><code ng:non-bindable="">route {Object} </code>
<p>Mapping information to be assigned to <code>$route.current</code> on route
match.</p>
<p>Object properties:</p>
<ul>
<li><code>controller</code> <code>{(string|function()=}</code> Controller fn that should be associated with newly
created scope or the name of a <a href="api/angular.Module#controller"><code>registered controller</code></a>
if passed as a string.</li>
<li><p><code>template</code> <code>{string=|function()=}</code> html template as a string or function that returns
an html template as a string which should be used by <a href="api/ng.directive:ngView"><code>ngView</code></a> or
<a href="api/ng.directive:ngInclude"><code>ngInclude</code></a> directives.
This property takes precedence over <code>templateUrl</code>.</p>
<p>If <code>template</code> is a function, it will be called with the following parameters:</p>
<ul><li><code>{Array.&lt;Object&gt;}</code> - route parameters extracted from the current
<code>$location.path()</code> by applying the current route</li></ul></li>
<li><p><code>templateUrl</code> <code>{string=|function()=}</code> path or function that returns a path to an html
template that should be used by <a href="api/ng.directive:ngView"><code>ngView</code></a>.</p>
<p>If <code>templateUrl</code> is a function, it will be called with the following parameters:</p>
<ul><li><code>{Array.&lt;Object&gt;}</code> - route parameters extracted from the current
<code>$location.path()</code> by applying the current route</li></ul></li>
<li><p><code>resolve</code> - <code>{Object.&lt;string, function&gt;=}</code> - An optional map of dependencies which should
be injected into the controller. If any of these dependencies are promises, they will be
resolved and converted to a value before the controller is instantiated and the
<code>$routeChangeSuccess</code> event is fired. The map object is:</p>
<ul><li><code>key</code> <code>{string}</code>: a name of a dependency to be injected into the controller.</li>
<li><code>factory</code> - <code>{string|function}</code>: If <code>string</code> then it is an alias for a service.
Otherwise if function, then it is <a href="api/AUTO.$injector#invoke"><code>injected</code></a>
and the return value is treated as the dependency. If the result is a promise, it is resolved
before its value is injected into the controller.</li></ul></li>
<li><p><code>redirectTo</code> {(string|function())=} value to update
<a href="api/ng.$location"><code>$location</code></a> path with and trigger route redirection.</p>
<p>If <code>redirectTo</code> is a function, it will be called with the following parameters:</p>
<ul><li><code>{Object.&lt;string&gt;}</code> - route parameters extracted from the current
<code>$location.path()</code> by applying the current route templateUrl.</li>
<li><code>{string}</code> - current <code>$location.path()</code></li>
<li><code>{Object}</code> - current <code>$location.search()</code></li></ul>
<p>The custom <code>redirectTo</code> function is expected to return a string which will be used
to update <code>$location.path()</code> and <code>$location.search()</code>.</p></li>
<li><p><code>[reloadOnSearch=true]</code> - {boolean=} - reload route when only $location.search()
changes.</p>
<p>If the option is set to <code>false</code> and url in the browser changes, then
<code>$routeUpdate</code> event is broadcasted on the root scope.</p></li>
<li><p><code>[caseInsensitiveMatch=false]</code> - {boolean=} - match routes without being case sensitive</p>
<p>If the option is set to <code>true</code>, then the particular route can be matched without being
case sensitive</p></li>
</ul></li>
</ul>
<h4 id="Returns">Returns</h4>
<div class="returns"><code ng:non-bindable="">{Object}</code>
<p>self</p></div>
</div>
</li>
</ul>
</div>
</div>

View file

@ -0,0 +1,348 @@
<a href="http://github.com/angular/angular.js/tree/v1.2.0rc1/src/ng/sce.js#L332" 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/sce.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">$sce</code>
<div><span class="hint">service in module <code ng:non-bindable="">ng</code>
</span>
</div>
</h1>
<div><h2 id="Description">Description</h2>
<div class="description"><div class="ng-sce-page"><p><code>$sce</code> is a service that provides Strict Contextual Escaping services to AngularJS.</p>
<h3>Strict Contextual Escaping</h3>
<p>Strict Contextual Escaping (SCE) is a mode in which AngularJS requires bindings in certain
contexts to result in a value that is marked as safe to use for that context One example of such
a context is binding arbitrary html controlled by the user via <code>ng-bind-html</code>. We refer to these
contexts as privileged or SCE contexts.</p>
<p>As of version 1.2, Angular ships with SCE enabled by default.</p>
<p>Note: When enabled (the default), IE8 in quirks mode is not supported. In this mode, IE8 allows
one to execute arbitrary javascript by the use of the expression() syntax. Refer
<a href="http://blogs.msdn.com/b/ie/archive/2008/10/16/ending-expressions.aspx">http://blogs.msdn.com/b/ie/archive/2008/10/16/ending-expressions.aspx</a> to learn more about them.
You can ensure your document is in standards mode and not quirks mode by adding <code>&lt;!doctype html&gt;</code>
to the top of your HTML document.</p>
<p>SCE assists in writing code in way that (a) is secure by default and (b) makes auditing for
security vulnerabilities such as XSS, clickjacking, etc. a lot easier.</p>
<p>Here&#39;s an example of a binding in a privileged context:</p>
<pre class="prettyprint" class="prettyprint linenums">
&lt;input ng-model="userHtml"&gt;
&lt;div ng-bind-html="{{userHtml}}"&gt;
</pre>
<p>Notice that <code>ng-bind-html</code> is bound to <code>{{userHtml}}</code> controlled by the user. With SCE
disabled, this application allows the user to render arbitrary HTML into the DIV.
In a more realistic example, one may be rendering user comments, blog articles, etc. via
bindings. (HTML is just one example of a context where rendering user controlled input creates
security vulnerabilities.)</p>
<p>For the case of HTML, you might use a library, either on the client side, or on the server side,
to sanitize unsafe HTML before binding to the value and rendering it in the document.</p>
<p>How would you ensure that every place that used these types of bindings was bound to a value that
was sanitized by your library (or returned as safe for rendering by your server?) How can you
ensure that you didn&#39;t accidentally delete the line that sanitized the value, or renamed some
properties/fields and forgot to update the binding to the sanitized value?</p>
<p>To be secure by default, you want to ensure that any such bindings are disallowed unless you can
determine that something explicitly says it&#39;s safe to use a value for binding in that
context. You can then audit your code (a simple grep would do) to ensure that this is only done
for those values that you can easily tell are safe - because they were received from your server,
sanitized by your library, etc. You can organize your codebase to help with this - perhaps
allowing only the files in a specific directory to do this. Ensuring that the internal API
exposed by that code doesn&#39;t markup arbitrary values as safe then becomes a more manageable task.</p>
<p>In the case of AngularJS&#39; SCE service, one uses <a href="../../../../../index.htmle#trustAs"><code>$sce.trustAs</code></a> (and shorthand
methods such as <a href="../../../../../index.htmle#trustAsHtml"><code>$sce.trustAsHtml</code></a>, etc.) to obtain values that will be
accepted by SCE / privileged contexts.</p>
<h4>How does it work?</h2>
<p>In privileged contexts, directives and code will bind to the result of <a href="../../../../../index.htmle#getTrusted"><code>$sce.getTrusted(context, value)</code></a> rather than to the value directly. Directives use <a href="../../../../../index.htmle#parse"><code>$sce.parseAs</code></a> rather than <code>$parse</code> to watch attribute bindings, which performs the
<a href="../../../../../index.htmle#getTrusted"><code>$sce.getTrusted</code></a> behind the scenes on non-constant literals.</p>
<p>As an example, <a href="../../../../../index.htmlective:ngBindHtml"><code>ngBindHtml</code></a> uses <a href="../../../../../index.htmle#parseHtml"><code>$sce.parseAsHtml(binding expression)</code></a>. Here&#39;s the actual code (slightly
simplified):</p>
<pre class="prettyprint" class="prettyprint linenums">
var ngBindHtmlDirective = ['$sce', function($sce) {
return function(scope, element, attr) {
scope.$watch($sce.parseAsHtml(attr.ngBindHtml), function(value) {
element.html(value || '');
});
};
}];
</pre>
<h2>Impact on loading templates</h2>
<p>This applies both to the <a href="../../../../../index.htmlective:ngInclude"><code><code>ng-include</code></code></a> directive as well as
<code>templateUrl</code>&#39;s specified by <a href="../../../../../index.htmlctive">directives</a>.</p>
<p>By default, Angular only loads templates from the same domain and protocol as the application
document. This is done by calling <a href="../../../../../index.htmle#getTrustedResourceUrl"><code>$sce.getTrustedResourceUrl</code></a> on the template URL. To load templates from other domains and/or
protocols, you may either either <a href="../../../../../index.htmleDelegateProvider#resourceUrlWhitelist"><code>whitelist them</code></a> or <a href="../../../../../index.htmle#trustAsResourceUrl"><code>wrap it</code></a> into a trusted value.</p>
<p><em>Please note</em>:
The browser&#39;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 in addition to this and may further restrict whether the template is successfully
loaded. This means that without the right CORS policy, loading templates from a different domain
won&#39;t work on all browsers. Also, loading templates from <code>file://</code> URL does not work on some
browsers.</p>
<h2>This feels like too much overhead for the developer?</h2>
<p>It&#39;s important to remember that SCE only applies to interpolation expressions.</p>
<p>If your expressions are constant literals, they&#39;re automatically trusted and you don&#39;t need to
call <code>$sce.trustAs</code> on them. (e.g.
<code>&lt;div ng-html-bind-unsafe=&quot;&#39;&lt;b&gt;implicitly trusted&lt;/b&gt;&#39;&quot;&gt;&lt;/div&gt;</code>) just works.</p>
<p>Additionally, <code>a[href]</code> and <code>img[src]</code> automatically sanitize their URLs and do not pass them
through <a href="../../../../../index.htmle#getTrusted"><code>$sce.getTrusted</code></a>. SCE doesn&#39;t play a role here.</p>
<p>The included <a href="../../../../../index.htmleDelegate"><code>$sceDelegate</code></a> comes with sane defaults to allow you to load
templates in <code>ng-include</code> from your application&#39;s domain without having to even know about SCE.
It blocks loading templates from other domains or loading templates over http from an https
served document. You can change these by setting your own custom <a href="../../../../../index.htmleDelegateProvider#resourceUrlWhitelist"><code>whitelists</code></a> and <a href="../../../../../index.htmleDelegateProvider#resourceUrlBlacklist"><code>blacklists</code></a> for matching such URLs.</p>
<p>This significantly reduces the overhead. It is far easier to pay the small overhead and have an
application that&#39;s secure and can be audited to verify that with much more ease than bolting
security onto an application later.</p>
<h2>What trusted context types are supported?<a name="contexts"></a></h2>
<p>| Context | Notes |
|=====================|================|
| <code>$sce.HTML</code> | For HTML that&#39;s safe to source into the application. The <a href="../../../../../index.htmlective:ngBindHtml"><code>ngBindHtml</code></a> directive uses this context for bindings. |
| <code>$sce.CSS</code> | For CSS that&#39;s safe to source into the application. Currently unused. Feel free to use it in your own directives. |
| <code>$sce.URL</code> | For URLs that are safe to follow as links. Currently unused (<code>&lt;a href=</code> and <code>&lt;img src=</code> sanitize their urls and don&#39;t consititute an SCE context. |
| <code>$sce.RESOURCE_URL</code> | For URLs that are not only safe to follow as links, but whose contens are also safe to include in your application. Examples include <code>ng-include</code>, <code>src</code> / <code>ngSrc</code> bindings for tags other than <code>IMG</code> (e.g. <code>IFRAME</code>, <code>OBJECT</code>, etc.) <br><br>Note that <code>$sce.RESOURCE_URL</code> makes a stronger statement about the URL than <code>$sce.URL</code> does and therefore contexts requiring values trusted for <code>$sce.RESOURCE_URL</code> can be used anywhere that values trusted for <code>$sce.URL</code> are required. |
| <code>$sce.JS</code> | For JavaScript that is safe to execute in your application&#39;s context. Currently unused. Feel free to use it in your own directives. |</p>
<h2>Show me an example.</h4>
</div></div>
<div class="member method"><h2 id="Methods">Methods</h2>
<ul class="methods"><li><h3 id="getTrusted">getTrusted(type, maybeTrusted)</h3>
<div class="gettrusted"><div class="ng-sce-gettrusted-page"><p>Delegates to <a href="../../../../../index.htmleDelegate#getTrusted"><code><code>$sceDelegate.getTrusted</code></code></a>. As such, takes
the result of a <a href="../../../../../index.htmle#trustAs"><code><code>$sce.trustAs</code></code></a>() call and returns the originally supplied
value if the queried context type is a supertype of the created type. If this condition
isn&#39;t satisfied, throws an exception.</p>
</div><h5 id="parameters">Parameters</h5><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>type</td><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="ng-sce-gettrusted-page"><p>The kind of context in which this value is to be used.</p>
</div></td></tr><tr><td>maybeTrusted</td><td><a href="" class="label type-hint type-hint-object">*</a></td><td><div class="ng-sce-gettrusted-page"><p>The result of a prior <a href="../../../../../index.htmle#trustAs"><code><code>$sce.trustAs</code></code></a> call.</p>
</div></td></tr></tbody></table><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-object">*</a></td><td><div class="ng-sce-gettrusted-page"><p>The value the was originally provided to <a href="../../../../../index.htmle#trustAs"><code><code>$sce.trustAs</code></code></a> if
valid in this context. Otherwise, throws an exception.</p>
</div></td></tr></table></div>
</li>
<li><h3 id="getTrustedCss">getTrustedCss(value)</h3>
<div class="gettrustedcss"><div class="ng-sce-gettrustedcss-page"><p>Shorthand method. <code>$sce.getTrustedCss(value)</code><a href="../../../../../index.htmleDelegate#getTrusted"><code><code>$sceDelegate.getTrusted($sce.CSS, value)</code></code></a></p>
</div><h5 id="parameters">Parameters</h5><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>value</td><td><a href="" class="label type-hint type-hint-object">*</a></td><td><div class="ng-sce-gettrustedcss-page"><p>The value to pass to <code>$sce.getTrusted</code>.</p>
</div></td></tr></tbody></table><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-object">*</a></td><td><div class="ng-sce-gettrustedcss-page"><p>The return value of <code>$sce.getTrusted($sce.CSS, value)</code></p>
</div></td></tr></table></div>
</li>
<li><h3 id="getTrustedHtml">getTrustedHtml(value)</h3>
<div class="gettrustedhtml"><div class="ng-sce-gettrustedhtml-page"><p>Shorthand method. <code>$sce.getTrustedHtml(value)</code><a href="../../../../../index.htmleDelegate#getTrusted"><code><code>$sceDelegate.getTrusted($sce.HTML, value)</code></code></a></p>
</div><h5 id="parameters">Parameters</h5><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>value</td><td><a href="" class="label type-hint type-hint-object">*</a></td><td><div class="ng-sce-gettrustedhtml-page"><p>The value to pass to <code>$sce.getTrusted</code>.</p>
</div></td></tr></tbody></table><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-object">*</a></td><td><div class="ng-sce-gettrustedhtml-page"><p>The return value of <code>$sce.getTrusted($sce.HTML, value)</code></p>
</div></td></tr></table></div>
</li>
<li><h3 id="getTrustedJs">getTrustedJs(value)</h3>
<div class="gettrustedjs"><div class="ng-sce-gettrustedjs-page"><p>Shorthand method. <code>$sce.getTrustedJs(value)</code><a href="../../../../../index.htmleDelegate#getTrusted"><code><code>$sceDelegate.getTrusted($sce.JS, value)</code></code></a></p>
</div><h5 id="parameters">Parameters</h5><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>value</td><td><a href="" class="label type-hint type-hint-object">*</a></td><td><div class="ng-sce-gettrustedjs-page"><p>The value to pass to <code>$sce.getTrusted</code>.</p>
</div></td></tr></tbody></table><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-object">*</a></td><td><div class="ng-sce-gettrustedjs-page"><p>The return value of <code>$sce.getTrusted($sce.JS, value)</code></p>
</div></td></tr></table></div>
</li>
<li><h3 id="getTrustedResourceUrl">getTrustedResourceUrl(value)</h3>
<div class="gettrustedresourceurl"><div class="ng-sce-gettrustedresourceurl-page"><p>Shorthand method. <code>$sce.getTrustedResourceUrl(value)</code><a href="../../../../../index.htmleDelegate#getTrusted"><code><code>$sceDelegate.getTrusted($sce.RESOURCE_URL, value)</code></code></a></p>
</div><h5 id="parameters">Parameters</h5><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>value</td><td><a href="" class="label type-hint type-hint-object">*</a></td><td><div class="ng-sce-gettrustedresourceurl-page"><p>The value to pass to <code>$sceDelegate.getTrusted</code>.</p>
</div></td></tr></tbody></table><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-object">*</a></td><td><div class="ng-sce-gettrustedresourceurl-page"><p>The return value of <code>$sce.getTrusted($sce.RESOURCE_URL, value)</code></p>
</div></td></tr></table></div>
</li>
<li><h3 id="getTrustedUrl">getTrustedUrl(value)</h3>
<div class="gettrustedurl"><div class="ng-sce-gettrustedurl-page"><p>Shorthand method. <code>$sce.getTrustedUrl(value)</code><a href="../../../../../index.htmleDelegate#getTrusted"><code><code>$sceDelegate.getTrusted($sce.URL, value)</code></code></a></p>
</div><h5 id="parameters">Parameters</h5><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>value</td><td><a href="" class="label type-hint type-hint-object">*</a></td><td><div class="ng-sce-gettrustedurl-page"><p>The value to pass to <code>$sce.getTrusted</code>.</p>
</div></td></tr></tbody></table><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-object">*</a></td><td><div class="ng-sce-gettrustedurl-page"><p>The return value of <code>$sce.getTrusted($sce.URL, value)</code></p>
</div></td></tr></table></div>
</li>
<li><h3 id="parse">parse(type, expression)</h3>
<div class="parse"><div class="ng-sce-parse-page"><p>Converts Angular <a href="../../../../../index.htmlession">expression</a> into a function. This is like <a href="../../../../../index.htmlrse"><code>$parse</code></a> and is identical when the expression is a literal constant. Otherwise, it
wraps the expression in a call to <a href="../../../../../index.htmle#getTrusted"><code>$sce.getTrusted(<em>type</em>, <em>result</em>)</code></a></p>
</div><h5 id="parameters">Parameters</h5><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>type</td><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="ng-sce-parse-page"><p>The kind of SCE context in which this result will be used.</p>
</div></td></tr><tr><td>expression</td><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="ng-sce-parse-page"><p>String expression to compile.</p>
</div></td></tr></tbody></table><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-function">function(context, locals)</a></td><td><div class="ng-sce-parse-page"><p>a function which represents the compiled expression:</p>
<ul>
<li><code>context</code> <code>{object}</code> an object against which any expressions embedded in the strings
are evaluated against (typically a scope object).</li>
<li><code>locals</code> <code>{object=}</code> local variables context object, useful for overriding values in
<code>context</code>.</li>
</ul>
</div></td></tr></table></div>
</li>
<li><h3 id="parseAsCss">parseAsCss(expression)</h3>
<div class="parseascss"><div class="ng-sce-parseascss-page"><p>Shorthand method. <code>$sce.parseAsCss(value)</code><a href="../../../../../index.htmle#parse"><code><code>$sce.parseAs($sce.CSS, value)</code></code></a></p>
</div><h5 id="parameters">Parameters</h5><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>expression</td><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="ng-sce-parseascss-page"><p>String expression to compile.</p>
</div></td></tr></tbody></table><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-function">function(context, locals)</a></td><td><div class="ng-sce-parseascss-page"><p>a function which represents the compiled expression:</p>
<ul>
<li><code>context</code> <code>{object}</code> an object against which any expressions embedded in the strings
are evaluated against (typically a scope object).</li>
<li><code>locals</code> <code>{object=}</code> local variables context object, useful for overriding values in
<code>context</code>.</li>
</ul>
</div></td></tr></table></div>
</li>
<li><h3 id="parseAsHtml">parseAsHtml(expression)</h3>
<div class="parseashtml"><div class="ng-sce-parseashtml-page"><p>Shorthand method. <code>$sce.parseAsHtml(expression string)</code><a href="../../../../../index.htmle#parse"><code><code>$sce.parseAs($sce.HTML, value)</code></code></a></p>
</div><h5 id="parameters">Parameters</h5><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>expression</td><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="ng-sce-parseashtml-page"><p>String expression to compile.</p>
</div></td></tr></tbody></table><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-function">function(context, locals)</a></td><td><div class="ng-sce-parseashtml-page"><p>a function which represents the compiled expression:</p>
<ul>
<li><code>context</code> <code>{object}</code> an object against which any expressions embedded in the strings
are evaluated against (typically a scope object).</li>
<li><code>locals</code> <code>{object=}</code> local variables context object, useful for overriding values in
<code>context</code>.</li>
</ul>
</div></td></tr></table></div>
</li>
<li><h3 id="parseAsJs">parseAsJs(expression)</h3>
<div class="parseasjs"><div class="ng-sce-parseasjs-page"><p>Shorthand method. <code>$sce.parseAsJs(value)</code><a href="../../../../../index.htmle#parse"><code><code>$sce.parseAs($sce.JS, value)</code></code></a></p>
</div><h5 id="parameters">Parameters</h5><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>expression</td><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="ng-sce-parseasjs-page"><p>String expression to compile.</p>
</div></td></tr></tbody></table><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-function">function(context, locals)</a></td><td><div class="ng-sce-parseasjs-page"><p>a function which represents the compiled expression:</p>
<ul>
<li><code>context</code> <code>{object}</code> an object against which any expressions embedded in the strings
are evaluated against (typically a scope object).</li>
<li><code>locals</code> <code>{object=}</code> local variables context object, useful for overriding values in
<code>context</code>.</li>
</ul>
</div></td></tr></table></div>
</li>
<li><h3 id="parseAsResourceUrl">parseAsResourceUrl(expression)</h3>
<div class="parseasresourceurl"><div class="ng-sce-parseasresourceurl-page"><p>Shorthand method. <code>$sce.parseAsResourceUrl(value)</code><a href="../../../../../index.htmle#parse"><code><code>$sce.parseAs($sce.RESOURCE_URL, value)</code></code></a></p>
</div><h5 id="parameters">Parameters</h5><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>expression</td><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="ng-sce-parseasresourceurl-page"><p>String expression to compile.</p>
</div></td></tr></tbody></table><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-function">function(context, locals)</a></td><td><div class="ng-sce-parseasresourceurl-page"><p>a function which represents the compiled expression:</p>
<ul>
<li><code>context</code> <code>{object}</code> an object against which any expressions embedded in the strings
are evaluated against (typically a scope object).</li>
<li><code>locals</code> <code>{object=}</code> local variables context object, useful for overriding values in
<code>context</code>.</li>
</ul>
</div></td></tr></table></div>
</li>
<li><h3 id="parseAsUrl">parseAsUrl(expression)</h3>
<div class="parseasurl"><div class="ng-sce-parseasurl-page"><p>Shorthand method. <code>$sce.parseAsUrl(value)</code><a href="../../../../../index.htmle#parse"><code><code>$sce.parseAs($sce.URL, value)</code></code></a></p>
</div><h5 id="parameters">Parameters</h5><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>expression</td><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="ng-sce-parseasurl-page"><p>String expression to compile.</p>
</div></td></tr></tbody></table><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-function">function(context, locals)</a></td><td><div class="ng-sce-parseasurl-page"><p>a function which represents the compiled expression:</p>
<ul>
<li><code>context</code> <code>{object}</code> an object against which any expressions embedded in the strings
are evaluated against (typically a scope object).</li>
<li><code>locals</code> <code>{object=}</code> local variables context object, useful for overriding values in
<code>context</code>.</li>
</ul>
</div></td></tr></table></div>
</li>
<li><h3 id="trustAs">trustAs(type, value)</h3>
<div class="trustas"><div class="ng-sce-trustas-page"><p>Delegates to <a href="../../../../../index.htmleDelegate#trustAs"><code><code>$sceDelegate.trustAs</code></code></a>. As such, returns an object
that is trusted by angular for use in specified strict contextual escaping contexts (such as
ng-html-bind-unsafe, ng-include, any src attribute interpolation, any dom event binding
attribute interpolation such as for onclick, etc.) that uses the provided value. See *
<a href="../../../../../index.htmle"><code>$sce</code></a> for enabling strict contextual escaping.</p>
</div><h5 id="parameters">Parameters</h5><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>type</td><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="ng-sce-trustas-page"><p>The kind of context in which this value is safe for use. e.g. url,
resource_url, html, js and css.</p>
</div></td></tr><tr><td>value</td><td><a href="" class="label type-hint type-hint-object">*</a></td><td><div class="ng-sce-trustas-page"><p>The value that that should be considered trusted/safe.</p>
</div></td></tr></tbody></table><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-object">*</a></td><td><div class="ng-sce-trustas-page"><p>A value that can be used to stand in for the provided <code>value</code> in places
where Angular expects a $sce.trustAs() return value.</p>
</div></td></tr></table></div>
</li>
<li><h3 id="trustAsHtml">trustAsHtml(value)</h3>
<div class="trustashtml"><div class="ng-sce-trustashtml-page"><p>Shorthand method. <code>$sce.trustAsHtml(value)</code><a href="../../../../../index.htmleDelegate#trustAs"><code><code>$sceDelegate.trustAs($sce.HTML, value)</code></code></a></p>
</div><h5 id="parameters">Parameters</h5><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>value</td><td><a href="" class="label type-hint type-hint-object">*</a></td><td><div class="ng-sce-trustashtml-page"><p>The value to trustAs.</p>
</div></td></tr></tbody></table><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-object">*</a></td><td><div class="ng-sce-trustashtml-page"><p>An object that can be passed to <a href="../../../../../index.htmle#getTrustedHtml"><code>$sce.getTrustedHtml(value)</code></a> to obtain the original value. (privileged directives
only accept expressions that are either literal constants or are the
return value of <a href="../../../../../index.htmle#trustAs"><code>$sce.trustAs</code></a>.)</p>
</div></td></tr></table></div>
</li>
<li><h3 id="trustAsJs">trustAsJs(value)</h3>
<div class="trustasjs"><div class="ng-sce-trustasjs-page"><p>Shorthand method. <code>$sce.trustAsJs(value)</code><a href="../../../../../index.htmleDelegate#trustAs"><code><code>$sceDelegate.trustAs($sce.JS, value)</code></code></a></p>
</div><h5 id="parameters">Parameters</h5><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>value</td><td><a href="" class="label type-hint type-hint-object">*</a></td><td><div class="ng-sce-trustasjs-page"><p>The value to trustAs.</p>
</div></td></tr></tbody></table><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-object">*</a></td><td><div class="ng-sce-trustasjs-page"><p>An object that can be passed to <a href="../../../../../index.htmle#getTrustedJs"><code>$sce.getTrustedJs(value)</code></a> to obtain the original value. (privileged directives
only accept expressions that are either literal constants or are the
return value of <a href="../../../../../index.htmle#trustAs"><code>$sce.trustAs</code></a>.)</p>
</div></td></tr></table></div>
</li>
<li><h3 id="trustAsResourceUrl">trustAsResourceUrl(value)</h3>
<div class="trustasresourceurl"><div class="ng-sce-trustasresourceurl-page"><p>Shorthand method. <code>$sce.trustAsResourceUrl(value)</code><a href="../../../../../index.htmleDelegate#trustAs"><code><code>$sceDelegate.trustAs($sce.RESOURCE_URL, value)</code></code></a></p>
</div><h5 id="parameters">Parameters</h5><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>value</td><td><a href="" class="label type-hint type-hint-object">*</a></td><td><div class="ng-sce-trustasresourceurl-page"><p>The value to trustAs.</p>
</div></td></tr></tbody></table><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-object">*</a></td><td><div class="ng-sce-trustasresourceurl-page"><p>An object that can be passed to <a href="../../../../../index.htmle#getTrustedResourceUrl"><code>$sce.getTrustedResourceUrl(value)</code></a> to obtain the original value. (privileged directives
only accept expressions that are either literal constants or are the return
value of <a href="../../../../../index.htmle#trustAs"><code>$sce.trustAs</code></a>.)</p>
</div></td></tr></table></div>
</li>
<li><h3 id="trustAsUrl">trustAsUrl(value)</h3>
<div class="trustasurl"><div class="ng-sce-trustasurl-page"><p>Shorthand method. <code>$sce.trustAsUrl(value)</code><a href="../../../../../index.htmleDelegate#trustAs"><code><code>$sceDelegate.trustAs($sce.URL, value)</code></code></a></p>
</div><h5 id="parameters">Parameters</h5><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>value</td><td><a href="" class="label type-hint type-hint-object">*</a></td><td><div class="ng-sce-trustasurl-page"><p>The value to trustAs.</p>
</div></td></tr></tbody></table><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-object">*</a></td><td><div class="ng-sce-trustasurl-page"><p>An object that can be passed to <a href="../../../../../index.htmle#getTrustedUrl"><code>$sce.getTrustedUrl(value)</code></a> to obtain the original value. (privileged directives
only accept expressions that are either literal constants or are the
return value of <a href="../../../../../index.htmle#trustAs"><code>$sce.trustAs</code></a>.)</p>
</div></td></tr></table></div>
</li>
<li><h3 id="isEnabled">isEnabled()</h3>
<div class="isenabled"><div class="ng-sce-isenabled-page"><p>Returns a boolean indicating if SCE is enabled.</p>
</div><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-boolean">Boolean</a></td><td><div class="ng-sce-isenabled-page"><p>true if SCE is enabled, false otherwise. If you want to set the value, you
have to do it at module config time on <a href="../../../../../index.htmleProvider"><code>$sceProvider</code></a>.</p>
</div></td></tr></table></div>
</li>
</ul>
</div>
<h2 id="Example">Example</h2>
<div class="example"><div class="ng-sce-page"><h4>Source</h2>
<div source-edit="mySceApp" source-edit-deps="angular.js script.js" source-edit-html="index.html-133" source-edit-css="" source-edit-js="script.js-134" source-edit-json="test_data.json" source-edit-unit="" source-edit-scenario="scenario.js-135"></div>
<div class="tabbable"><div class="tab-pane" title="index.html">
<pre class="prettyprint linenums" ng-set-text="index.html-133" ng-html-wrap="mySceApp angular.js script.js"></pre>
<script type="text/ng-template" id="index.html-133">
<div ng-controller="myAppController as myCtrl">
<i ng-bind-html="myCtrl.explicitlyTrustedHtml" id="explicitlyTrustedHtml"></i><br><br>
<b>User comments</b><br>
By default, HTML that isn't explicitly trusted (e.g. Alice's comment) is sanitized when $sanitize is available. If $sanitize isn't available, this results in an error instead of an exploit.
<div class="well">
<div ng-repeat="userComment in myCtrl.userComments">
<b>{{userComment.name}}</b>:
<span ng-bind-html="userComment.htmlComment" class="htmlComment"></span>
<br>
</div>
</div>
</div>
</script>
</div>
<div class="tab-pane" title="script.js">
<pre class="prettyprint linenums" ng-set-text="script.js-134"></pre>
<script type="text/ng-template" id="script.js-134">
var mySceApp = angular.module('mySceApp', ['ngSanitize']);
mySceApp.controller("myAppController", function myAppController($http, $templateCache, $sce) {
var self = this;
$http.get("test_data.json", {cache: $templateCache}).success(function(userComments) {
self.userComments = userComments;
});
self.explicitlyTrustedHtml = $sce.trustAsHtml(
'<span onmouseover="this.textContent=&quot;Explicitly trusted HTML bypasses ' +
'sanitization.&quot;">Hover over this text.</span>');
});
</script>
</div>
<div class="tab-pane" title="test_data.json">
<pre class="prettyprint linenums" ng-set-text="test_data.json"></pre>
<script type="text/ng-template" id="test_data.json">
[
{ "name": "Alice",
"htmlComment": "<span onmouseover='this.textContent=\"PWN3D!\"'>Is <i>anyone</i> reading this?</span>"
},
{ "name": "Bob",
"htmlComment": "<i>Yes!</i> Am I the only other one?"
}
]
</script>
</div>
<div class="tab-pane" title="End to end test">
<pre class="prettyprint linenums" ng-set-text="scenario.js-135"></pre>
<script type="text/ng-template" id="scenario.js-135">
describe('SCE doc demo', function() {
it('should sanitize untrusted values', function() {
expect(element('.htmlComment').html()).toBe('<span>Is <i>anyone</i> reading this?</span>');
});
it('should NOT sanitize explicitly trusted values', function() {
expect(element('#explicitlyTrustedHtml').html()).toBe(
'<span onmouseover="this.textContent=&quot;Explicitly trusted HTML bypasses ' +
'sanitization.&quot;">Hover over this text.</span>');
});
});
</script>
</div>
</div><h2>Demo</h2>
<div class="well doc-example-live animate-container" ng-embed-app="mySceApp" ng-set-html="index.html-133" ng-eval-javascript="script.js-134"></div>
<h2>Can I disable SCE completely?</h4>
<p>Yes, you can. However, this is strongly discouraged. SCE gives you a lot of security benefits
for little coding overhead. It will be much harder to take an SCE disabled application and
either secure it on your own or enable SCE at a later stage. It might make sense to disable SCE
for cases where you have a lot of existing code that was written before SCE was introduced and
you&#39;re migrating them a module at a time.</p>
<p>That said, here&#39;s how you can completely disable SCE:</p>
<pre class="prettyprint" class="prettyprint linenums">
angular.module('myAppWithSceDisabledmyApp', []).config(function($sceProvider) {
// Completely disable SCE. For demonstration purposes only!
// Do not use in new projects.
$sceProvider.enabled(false);
});
</pre>
</div></div>
</div>

View file

@ -0,0 +1,54 @@
<a href="http://github.com/angular/angular.js/tree/v1.2.0rc1/src/ng/sce.js#L16" 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/sce.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">$sceDelegate</code>
<div><span class="hint">service in module <code ng:non-bindable="">ng</code>
</span>
</div>
</h1>
<div><h2 id="Description">Description</h2>
<div class="description"><div class="ng-scedelegate-page"><p><code>$sceDelegate</code> is a service that is used by the <code>$sce</code> service to provide <a href="api/ng.$sce"><code>Strict Contextual Escaping (SCE)</code></a> services to AngularJS.</p>
<p>Typically, you would configure or override the <a href="api/ng.$sceDelegate"><code>$sceDelegate</code></a> instead of
the <code>$sce</code> service to customize the way Strict Contextual Escaping works in AngularJS. This is
because, while the <code>$sce</code> provides numerous shorthand methods, etc., you really only need to
override 3 core functions (<code>trustAs</code>, <code>getTrusted</code> and <code>valueOf</code>) to replace the way things
work because <code>$sce</code> delegates to <code>$sceDelegate</code> for these operations.</p>
<p>Refer <a href="api/ng.$sceDelegateProvider"><code>$sceDelegateProvider</code></a> to configure this service.</p>
<p>The default instance of <code>$sceDelegate</code> should work out of the box with little pain. While you
can override it completely to change the behavior of <code>$sce</code>, the common case would
involve configuring the <a href="api/ng.$sceDelegateProvider"><code>$sceDelegateProvider</code></a> instead by setting
your own whitelists and blacklists for trusting URLs used for loading AngularJS resources such as
templates. Refer <a href="api/ng.$sceDelegateProvider#resourceUrlWhitelist"><code>$sceDelegateProvider.resourceUrlWhitelist</code></a> and <a href="api/ng.$sceDelegateProvider#resourceUrlBlacklist"><code>$sceDelegateProvider.resourceUrlBlacklist</code></a></p>
</div></div>
<div class="member method"><h2 id="Methods">Methods</h2>
<ul class="methods"><li><h3 id="getTrusted">getTrusted(type, maybeTrusted)</h3>
<div class="gettrusted"><div class="ng-scedelegate-gettrusted-page"><p>Takes the result of a <a href="api/ng.$sceDelegate#trustAs"><code><code>$sceDelegate.trustAs</code></code></a> call and returns the
originally supplied value if the queried context type is a supertype of the created type. If
this condition isn&#39;t satisfied, throws an exception.</p>
</div><h5 id="parameters">Parameters</h5><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>type</td><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="ng-scedelegate-gettrusted-page"><p>The kind of context in which this value is to be used.</p>
</div></td></tr><tr><td>maybeTrusted</td><td><a href="" class="label type-hint type-hint-object">*</a></td><td><div class="ng-scedelegate-gettrusted-page"><p>The result of a prior <a href="api/ng.$sceDelegate#trustAs"><code><code>$sceDelegate.trustAs</code></code></a> call.</p>
</div></td></tr></tbody></table><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-object">*</a></td><td><div class="ng-scedelegate-gettrusted-page"><p>The value the was originally provided to <a href="api/ng.$sceDelegate#trustAs"><code><code>$sceDelegate.trustAs</code></code></a> if valid in this context. Otherwise, throws an exception.</p>
</div></td></tr></table></div>
</li>
<li><h3 id="trustAs">trustAs(type, value)</h3>
<div class="trustas"><div class="ng-scedelegate-trustas-page"><p>Returns an object that is trusted by angular for use in specified strict
contextual escaping contexts (such as ng-html-bind-unsafe, ng-include, any src
attribute interpolation, any dom event binding attribute interpolation
such as for onclick, etc.) that uses the provided value.
See <a href="api/ng.$sce"><code>$sce</code></a> for enabling strict contextual escaping.</p>
</div><h5 id="parameters">Parameters</h5><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>type</td><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="ng-scedelegate-trustas-page"><p>The kind of context in which this value is safe for use. e.g. url,
resourceUrl, html, js and css.</p>
</div></td></tr><tr><td>value</td><td><a href="" class="label type-hint type-hint-object">*</a></td><td><div class="ng-scedelegate-trustas-page"><p>The value that that should be considered trusted/safe.</p>
</div></td></tr></tbody></table><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-object">*</a></td><td><div class="ng-scedelegate-trustas-page"><p>A value that can be used to stand in for the provided <code>value</code> in places
where Angular expects a $sce.trustAs() return value.</p>
</div></td></tr></table></div>
</li>
<li><h3 id="valueOf">valueOf(value)</h3>
<div class="valueof"><div class="ng-scedelegate-valueof-page"><p>If the passed parameter had been returned by a prior call to <a href="api/ng.$sceDelegate#trustAs"><code><code>$sceDelegate.trustAs</code></code></a>, returns the value that had been passed to <a href="api/ng.$sceDelegate#trustAs"><code><code>$sceDelegate.trustAs</code></code></a>.</p>
<p>If the passed parameter is not a value that had been returned by <a href="api/ng.$sceDelegate#trustAs"><code><code>$sceDelegate.trustAs</code></code></a>, returns it as-is.</p>
</div><h5 id="parameters">Parameters</h5><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>value</td><td><a href="" class="label type-hint type-hint-object">*</a></td><td><div class="ng-scedelegate-valueof-page"><p>The result of a prior <a href="api/ng.$sceDelegate#trustAs"><code><code>$sceDelegate.trustAs</code></code></a>
call or anything else.</p>
</div></td></tr></tbody></table><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-object">*</a></td><td><div class="ng-scedelegate-valueof-page"><p>The value the was originally provided to <a href="api/ng.$sceDelegate#trustAs"><code><code>$sceDelegate.trustAs</code></code></a> if <code>value</code> is the result of such a call. Otherwise, returns <code>value</code>
unchanged.</p>
</div></td></tr></table></div>
</li>
</ul>
</div>
</div>

View file

@ -0,0 +1,46 @@
<a href="http://github.com/angular/angular.js/tree/v1.2.0rc1/src/ng/sce.js#L43" 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/sce.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">$sceDelegateProvider</code>
<div><span class="hint">service in module <code ng:non-bindable="">ng</code>
</span>
</div>
</h1>
<div><h2 id="Description">Description</h2>
<div class="description"><div class="ng-scedelegateprovider-page"><p>The $sceDelegateProvider provider allows developers to configure the <a href="api/ng.$sceDelegate"><code>$sceDelegate</code></a> service. This allows one to get/set the whitelists and blacklists used to ensure
that URLs used for sourcing Angular templates are safe. Refer <a href="api/ng.$sceDelegateProvider#resourceUrlWhitelist"><code>$sceDelegateProvider.resourceUrlWhitelist</code></a> and
<a href="api/ng.$sceDelegateProvider#resourceUrlBlacklist"><code>$sceDelegateProvider.resourceUrlBlacklist</code></a></p>
<p>Read more about <a href="api/ng.$sce"><code>Strict Contextual Escaping (SCE)</code></a>.</p>
</div></div>
<div class="member method"><h2 id="Methods">Methods</h2>
<ul class="methods"><li><h3 id="resourceUrlBlacklist">resourceUrlBlacklist(blacklist)</h3>
<div class="resourceurlblacklist"><div class="ng-scedelegateprovider-resourceurlblacklist-page"><p>Sets/Gets the blacklist of trusted resource URLs.</p>
</div><h5 id="parameters">Parameters</h5><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>blacklist <div><em>(optional)</em></div></td><td><a href="" class="label type-hint type-hint-array">Array</a></td><td><div class="ng-scedelegateprovider-resourceurlblacklist-page"><p>When provided, replaces the resourceUrlBlacklist with the value
provided. This must be an array.</p>
<p>Each element of this array must either be a regex or the special string <code>&#39;self&#39;</code> (see
<code>resourceUrlWhitelist</code> for meaning - it&#39;s only really useful there.)</p>
<p>When a regex is used, it is matched against the normalized / absolute URL of the resource
being tested.</p>
<p>The typical usage for the blacklist is to <strong>block <a href="http://cwe.mitre.org/data/definitions/601.html">open redirects</a></strong>
served by your domain as these would otherwise be trusted but actually return content from the redirected
domain.</p>
<p>Finally, <strong>the blacklist overrides the whitelist</strong> and has the final say.</p>
</div></td></tr></tbody></table><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-array">Array</a></td><td><div class="ng-scedelegateprovider-resourceurlblacklist-page"><p>the currently set blacklist array.</p>
<p>The <strong>default value</strong> when no whitelist has been explicitly set is the empty array (i.e. there is
no blacklist.)</p>
</div></td></tr></table></div>
</li>
<li><h3 id="resourceUrlWhitelist">resourceUrlWhitelist(whitelist)</h3>
<div class="resourceurlwhitelist"><div class="ng-scedelegateprovider-resourceurlwhitelist-page"><p>Sets/Gets the whitelist of trusted resource URLs.</p>
</div><h5 id="parameters">Parameters</h5><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>whitelist <div><em>(optional)</em></div></td><td><a href="" class="label type-hint type-hint-array">Array</a></td><td><div class="ng-scedelegateprovider-resourceurlwhitelist-page"><p>When provided, replaces the resourceUrlWhitelist with the value
provided. This must be an array.</p>
<p>Each element of this array must either be a regex or the special string <code>&#39;self&#39;</code>.</p>
<p>When a regex is used, it is matched against the normalized / absolute URL of the resource
being tested.</p>
<p>The <strong>special string</strong> <code>&#39;self&#39;</code> can be used to match against all URLs of the same domain as the
application document with the same protocol (allows sourcing https resources from http documents.)</p>
<p>Please note that <strong>an empty whitelist array will block all URLs</strong>!</p>
</div></td></tr></tbody></table><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-array">Array</a></td><td><div class="ng-scedelegateprovider-resourceurlwhitelist-page"><p>the currently set whitelist array.</p>
<p>The <strong>default value</strong> when no whitelist has been explicitly set is <code>[&#39;self&#39;]</code>.</p>
</div></td></tr></table></div>
</li>
</ul>
</div>
</div>

View file

@ -0,0 +1,21 @@
<a href="http://github.com/angular/angular.js/tree/v1.2.0rc1/src/ng/sce.js#L320" 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/sce.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">$sceProvider</code>
<div><span class="hint">service in module <code ng:non-bindable="">ng</code>
</span>
</div>
</h1>
<div><h2 id="Description">Description</h2>
<div class="description"><div class="ng-sceprovider-page"><p>The $sceProvider provider allows developers to configure the <a href="api/ng.$sce"><code>$sce</code></a> service.
- enable/disable Strict Contextual Escaping (SCE) in a module
- override the default implementation with a custom delegate</p>
<p>Read more about <a href="api/ng.$sce"><code>Strict Contextual Escaping (SCE)</code></a>.</p>
</div></div>
<div class="member method"><h2 id="Methods">Methods</h2>
<ul class="methods"><li><h3 id="enabled">enabled(value)</h3>
<div class="enabled"><div class="ng-sceprovider-enabled-page"><p>Enables/disables SCE and returns the current value.</p>
</div><h5 id="parameters">Parameters</h5><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>value <div><em>(optional)</em></div></td><td><a href="" class="label type-hint type-hint-boolean">boolean</a></td><td><div class="ng-sceprovider-enabled-page"><p>If provided, then enables/disables SCE.</p>
</div></td></tr></tbody></table><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-boolean">boolean</a></td><td><div class="ng-sceprovider-enabled-page"><p>true if SCE is enabled, false otherwise.</p>
</div></td></tr></table></div>
</li>
</ul>
</div>
</div>

47
lib/angular/docs/partials/api/ng.$templateCache.html Normal file → Executable file
View file

@ -1,9 +1,40 @@
<h1><code ng:non-bindable="">$templateCache</code>
<span class="hint">(service in module <code ng:non-bindable="">ng</code>
)</span>
</h1>
<div><a href="http://github.com/angular/angular.js/edit/master/src/ng/cacheFactory.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p>Cache used for storing html templates.</p>
<p>See <a href="api/ng.$cacheFactory"><code>$cacheFactory</code></a>.</p></div>
<a href="http://github.com/angular/angular.js/tree/v1.2.0rc1/src/ng/cacheFactory.js#L192" 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/cacheFactory.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">$templateCache</code>
<div><span class="hint">service in module <code ng:non-bindable="">ng</code>
</span>
</div>
</h1>
<div><h2 id="Description">Description</h2>
<div class="description"><div class="ng-templatecache-page"><p>The first time a template is used, it is loaded in the template cache for quick retrieval. You can
load templates directly into the cache in a <code>script</code> tag, or by consuming the <code>$templateCache</code>
service directly.</p>
<p>Adding via the <code>script</code> tag:
<pre class="prettyprint linenums">
&lt;html ng-app&gt;
&lt;head&gt;
&lt;script type="text/ng-template" id="templateId.html"&gt;
This is the content of the template
&lt;/script&gt;
&lt;/head&gt;
...
&lt;/html&gt;
</pre>
<p><strong>Note:</strong> the <code>script</code> tag containing the template does not need to be included in the <code>head</code> of the document, but
it must be below the <code>ng-app</code> definition.</p>
<p>Adding via the $templateCache service:</p>
<pre class="prettyprint linenums">
var myApp = angular.module('myApp', []);
myApp.run(function($templateCache) {
$templateCache.put('templateId.html', 'This is the content of the template');
});
</pre>
<p>To retrieve the template later, simply use it in your HTML:
<pre class="prettyprint linenums">
&lt;div ng-include=" 'templateId.html' "&gt;&lt;/div&gt;
</pre>
<p>or get it via Javascript:
<pre class="prettyprint linenums">
$templateCache.get('templateId.html')
</pre>
<p>See <a href="api/ng.$cacheFactory"><code>$cacheFactory</code></a>.</p>
</div></div>
</div>

58
lib/angular/docs/partials/api/ng.$timeout.html Normal file → Executable file
View file

@ -1,51 +1,39 @@
<h1><code ng:non-bindable="">$timeout</code>
<span class="hint">(service in module <code ng:non-bindable="">ng</code>
)</span>
<a href="http://github.com/angular/angular.js/tree/v1.2.0rc1/src/ng/timeout.js#L10" 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/timeout.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">$timeout</code>
<div><span class="hint">service in module <code ng:non-bindable="">ng</code>
</span>
</div>
</h1>
<div><a href="http://github.com/angular/angular.js/edit/master/src/ng/timeout.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p>Angular's wrapper for <code>window.setTimeout</code>. The <code>fn</code> function is wrapped into a try/catch
<div><h2 id="Description">Description</h2>
<div class="description"><div class="ng-timeout-page"><p>Angular&#39;s wrapper for <code>window.setTimeout</code>. The <code>fn</code> function is wrapped into a try/catch
block and delegates any exceptions to
<a href="api/ng.$exceptionHandler"><code>$exceptionHandler</code></a> service.</p>
<p>The return value of registering a timeout function is a promise which will be resolved when
<p>The return value of registering a timeout function is a promise, which will be resolved when
the timeout is reached and the timeout function is executed.</p>
<p>To cancel a the timeout request, call <code>$timeout.cancel(promise)</code>.</p>
<p>To cancel a timeout request, call <code>$timeout.cancel(promise)</code>.</p>
<p>In tests you can use <a href="api/ngMock.$timeout"><code>$timeout.flush()</code></a> to
synchronously flush the queue of deferred functions.</p></div>
synchronously flush the queue of deferred functions.</p>
</div></div>
<h2 id="Dependencies">Dependencies</h2>
<ul class="dependencies"><li><code ng:non-bindable=""><a href="api/ng.$browser">$browser</a></code>
</li>
</ul>
<h2 id="Usage">Usage</h2>
<div class="usage"><pre class="prettyprint linenums">$timeout(fn[, delay][, invokeApply]);</pre>
<h3 id="Parameters">Parameters</h3>
<ul class="parameters"><li><code ng:non-bindable="">fn {function()} </code>
<p>A function, who's execution should be delayed.</p></li>
<li><code ng:non-bindable="">delay<i>(optional=0)</i> {number=} </code>
<p>Delay in milliseconds.</p></li>
<li><code ng:non-bindable="">invokeApply<i>(optional=true)</i> {boolean=} </code>
<p>If set to false skips model dirty checking, otherwise
will invoke <code>fn</code> within the <a href="api/ng.$rootScope.Scope#$apply"><code>$apply</code></a> block.</p></li>
</ul>
<h3 id="Returns">Returns</h3>
<div class="returns"><code ng:non-bindable="">{Promise}</code>
<p>Promise that will be resolved when the timeout is reached. The value this
promise will be resolved with is the return value of the <code>fn</code> function.</p></div>
</div>
<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>fn</td><td><a href="" class="label type-hint type-hint-function">function()</a></td><td><div class="ng-timeout-page"><p>A function, whose execution should be delayed.</p>
</div></td></tr><tr><td>delay <div><em>(optional)</em></div></td><td><a href="" class="label type-hint type-hint-number">number</a></td><td><div class="ng-timeout-page"><p>Delay in milliseconds.</p>
</div></td></tr><tr><td>invokeApply <div><em>(optional)</em></div></td><td><a href="" class="label type-hint type-hint-boolean">boolean</a></td><td><div class="ng-timeout-page"><p>If set to <code>false</code> skips model dirty checking, otherwise
will invoke <code>fn</code> within the <a href="api/ng.$rootScope.Scope#$apply"><code>$apply</code></a> block.</p>
</div></td></tr></tbody></table><h4 id="returns">Returns</h4><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-promise">Promise</a></td><td><div class="ng-timeout-page"><p>Promise that will be resolved when the timeout is reached. The value this
promise will be resolved with is the return value of the <code>fn</code> function.</p>
</div></td></tr></table></div>
<div class="member method"><h2 id="Methods">Methods</h2>
<ul class="methods"><li><h3 id="cancel">cancel(promise)</h3>
<div class="cancel"><p>Cancels a task associated with the <code>promise</code>. As a result of this the promise will be
resolved with a rejection.</p><h4 id="Parameters">Parameters</h4>
<ul class="parameters"><li><code ng:non-bindable="">promise<i>(optional)</i> {Promise=} </code>
<p>Promise returned by the <code>$timeout</code> function.</p></li>
</ul>
<h4 id="Returns">Returns</h4>
<div class="returns"><code ng:non-bindable="">{boolean}</code>
<p>Returns <code>true</code> if the task hasn't executed yet and was successfully
canceled.</p></div>
</div>
<div class="cancel"><div class="ng-timeout-cancel-page"><p>Cancels a task associated with the <code>promise</code>. As a result of this, the promise will be
resolved with a rejection.</p>
</div><h5 id="parameters">Parameters</h5><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>promise <div><em>(optional)</em></div></td><td><a href="" class="label type-hint type-hint-promise">Promise</a></td><td><div class="ng-timeout-cancel-page"><p>Promise returned by the <code>$timeout</code> function.</p>
</div></td></tr></tbody></table><h5 id="returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-boolean">boolean</a></td><td><div class="ng-timeout-cancel-page"><p>Returns <code>true</code> if the task hasn&#39;t executed yet and was successfully
canceled.</p>
</div></td></tr></table></div>
</li>
</ul>
</div>

57
lib/angular/docs/partials/api/ng.$window.html Normal file → Executable file
View file

@ -1,30 +1,51 @@
<h1><code ng:non-bindable="">$window</code>
<span class="hint">(service in module <code ng:non-bindable="">ng</code>
)</span>
<a href="http://github.com/angular/angular.js/tree/v1.2.0rc1/src/ng/window.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/window.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">$window</code>
<div><span class="hint">service in module <code ng:non-bindable="">ng</code>
</span>
</div>
</h1>
<div><a href="http://github.com/angular/angular.js/edit/master/src/ng/window.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p>A reference to the browser's <code>window</code> object. While <code>window</code>
<div><h2 id="Description">Description</h2>
<div class="description"><div class="ng-window-page"><p>A reference to the browser&#39;s <code>window</code> object. While <code>window</code>
is globally available in JavaScript, it causes testability problems, because
it is a global variable. In angular we always refer to it through the
<code>$window</code> service, so it may be overridden, removed or mocked for testing.</p>
<p>All expressions are evaluated with respect to current scope so they don't
suffer from window globality.</p></div>
<p>Expressions, like the one defined for the <code>ngClick</code> directive in the example
below, are evaluated with respect to the current scope. Therefore, there is
no risk of inadvertently coding in a dependency on a global value in such an
expression.</p>
</div></div>
<h2 id="Example">Example</h2>
<div class="example"><h4>Source</h4>
<div source-edit="" source-edit-deps="angular.js" source-edit-html="index.html-218" source-edit-css="" source-edit-js="" source-edit-unit="" source-edit-scenario="scenario.js-219"></div>
<div class="example"><div class="ng-window-page"><h4>Source</h2>
<div source-edit="" source-edit-deps="angular.js script.js" source-edit-html="index.html-137" source-edit-css="" source-edit-js="script.js-136" source-edit-json="" source-edit-unit="" source-edit-scenario="scenario.js-138"></div>
<div class="tabbable"><div class="tab-pane" title="index.html">
<pre class="prettyprint linenums" ng-set-text="index.html-218" ng-html-wrap=" angular.js"></pre>
<script type="text/ng-template" id="index.html-218">
<input ng-init="$window = $service('$window'); greeting='Hello World!'" type="text" ng-model="greeting" />
<button ng-click="$window.alert(greeting)">ALERT</button>
<pre class="prettyprint linenums" ng-set-text="index.html-137" ng-html-wrap=" angular.js script.js"></pre>
<script type="text/ng-template" id="index.html-137">
<div ng-controller="Ctrl">
<input type="text" ng-model="greeting" />
<button ng-click="$window.alert(greeting)">ALERT</button>
</div>
</script>
</div>
<div class="tab-pane" title="script.js">
<pre class="prettyprint linenums" ng-set-text="script.js-136"></pre>
<script type="text/ng-template" id="script.js-136">
function Ctrl($scope, $window) {
$scope.$window = $window;
$scope.greeting = 'Hello, World!';
}
</script>
</div>
<div class="tab-pane" title="End to end test">
<pre class="prettyprint linenums" ng-set-text="scenario.js-219"></pre>
<script type="text/ng-template" id="scenario.js-219">
<pre class="prettyprint linenums" ng-set-text="scenario.js-138"></pre>
<script type="text/ng-template" id="scenario.js-138">
it('should display the greeting in the input box', function() {
input('greeting').enter('Hello, E2E Tests');
// If we click the button it will block the test runner
// element(':button').click();
});
</script>
</div>
</div><h4>Demo</h4>
<div class="well doc-example-live animator-container" ng-embed-app="" ng-set-html="index.html-218" ng-eval-javascript=""></div></div>
</div><h2>Demo</h4>
<div class="well doc-example-live animate-container" ng-embed-app="" ng-set-html="index.html-137" ng-eval-javascript="script.js-136"></div>
</div></div>
</div>

17
lib/angular/docs/partials/api/ng.directive:a.html Normal file → Executable file
View file

@ -1,16 +1,17 @@
<h1><code ng:non-bindable="">a</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/a.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/a.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">a</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/a.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p>Modifies the default behavior of html A tag, so that the default action is prevented when href
<div><h2 id="Description">Description</h2>
<div class="description"><div class="ng-directive-page ng-directive-a-page"><p>Modifies the default behavior of html A tag, so that the default action is prevented when href
attribute is empty.</p>
<p>The reasoning for this change is to allow easy creation of action links with <code>ngClick</code> directive
without changing the location or causing page reloads, e.g.:
<code>&lt;a href="" ng-click="model.$save()"&gt;Save&lt;/a&gt;</code></p></div>
<code>&lt;a href=&quot;&quot; ng-click=&quot;model.$save()&quot;&gt;Save&lt;/a&gt;</code></p>
</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">&lt;a&gt;
<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">&lt;a&gt;
&lt;/a&gt;</pre>
</div>
</div>

View file

@ -1,47 +1,72 @@
<h1><code ng:non-bindable="">FormController</code>
<span class="hint">(type in module <code ng:non-bindable="">ng</code>
)</span>
<a href="http://github.com/angular/angular.js/tree/v1.2.0rc1/src/ng/directive/form.js#L12" 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/form.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">FormController</code>
<div><span class="hint">type 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/form.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p><code>FormController</code> keeps track of all its controls and nested forms as well as state of them,
<div><h2 id="Description">Description</h2>
<div class="description"><div class="ng-directive-page ng-directive-form-formcontroller-page"><p><code>FormController</code> keeps track of all its controls and nested forms as well as state of them,
such as being valid/invalid or dirty/pristine.</p>
<p>Each <a href="api/ng.directive:form"><code>form</code></a> directive creates an instance
of <code>FormController</code>.</p></div>
of <code>FormController</code>.</p>
</div></div>
<div class="member method"><h2 id="Methods">Methods</h2>
<ul class="methods"><li><h3 id="$setPristine">$setPristine()</h3>
<div class="$setpristine"><p>Sets the form to its pristine state.</p>
<p>This method can be called to remove the 'ng-dirty' class and set the form to its pristine
<ul class="methods"><li><h3 id="$addControl">$addControl()</h3>
<div class="$addcontrol"><div class="ng-directive-page ng-directive-form-formcontroller-addcontrol-page"><p>Register a control with the form.</p>
<p>Input elements using ngModelController do this automatically when they are linked.</p>
</div></div>
</li>
<li><h3 id="$removeControl">$removeControl()</h3>
<div class="$removecontrol"><div class="ng-directive-page ng-directive-form-formcontroller-removecontrol-page"><p>Deregister a control from the form.</p>
<p>Input elements using ngModelController do this automatically when they are destroyed.</p>
</div></div>
</li>
<li><h3 id="$setDirty">$setDirty()</h3>
<div class="$setdirty"><div class="ng-directive-page ng-directive-form-formcontroller-setdirty-page"><p>Sets the form to a dirty state.</p>
<p>This method can be called to add the &#39;ng-dirty&#39; class and set the form to a dirty
state (ng-dirty class). This method will also propagate to parent forms.</p>
</div></div>
</li>
<li><h3 id="$setPristine">$setPristine()</h3>
<div class="$setpristine"><div class="ng-directive-page ng-directive-form-formcontroller-setpristine-page"><p>Sets the form to its pristine state.</p>
<p>This method can be called to remove the &#39;ng-dirty&#39; class and set the form to its pristine
state (ng-pristine class). This method will also propagate to all the controls contained
in this form.</p>
<p>Setting a form back to a pristine state is often useful when we want to 'reuse' a form after
saving or resetting it.</p></div>
<p>Setting a form back to a pristine state is often useful when we want to &#39;reuse&#39; a form after
saving or resetting it.</p>
</div></div>
</li>
<li><h3 id="$setValidity">$setValidity()</h3>
<div class="$setvalidity"><div class="ng-directive-page ng-directive-form-formcontroller-setvalidity-page"><p>Sets the validity of a form control.</p>
<p>This method will also propagate to parent forms.</p>
</div></div>
</li>
</ul>
</div>
<div class="member property"><h2 id="Properties">Properties</h2>
<ul class="properties"><li><h3 id="$pristine">$pristine</h3>
<div class="$pristine"><p>True if user has not interacted with the form yet.</p></div>
<div class="$pristine"><div class="ng-directive-page ng-directive-form-formcontroller-page"><p>True if user has not interacted with the form yet.</p>
</div></div>
</li>
<li><h3 id="$dirty">$dirty</h3>
<div class="$dirty"><p>True if user has already interacted with the form.</p></div>
<div class="$dirty"><div class="ng-directive-page ng-directive-form-formcontroller-page"><p>True if user has already interacted with the form.</p>
</div></div>
</li>
<li><h3 id="$valid">$valid</h3>
<div class="$valid"><p>True if all of the containing forms and controls are valid.</p></div>
<div class="$valid"><div class="ng-directive-page ng-directive-form-formcontroller-page"><p>True if all of the containing forms and controls are valid.</p>
</div></div>
</li>
<li><h3 id="$invalid">$invalid</h3>
<div class="$invalid"><p>True if at least one containing control or form is invalid.</p></div>
<div class="$invalid"><div class="ng-directive-page ng-directive-form-formcontroller-page"><p>True if at least one containing control or form is invalid.</p>
</div></div>
</li>
<li><h3 id="$error">$error</h3>
<div class="$error"><p>Is an object hash, containing references to all invalid controls or
<div class="$error"><div class="ng-directive-page ng-directive-form-formcontroller-page"><p>Is an object hash, containing references to all invalid controls or
forms, where:</p>
<ul>
<li>keys are validation tokens (error names) — such as <code>required</code>, <code>url</code> or <code>email</code>),</li>
<li>values are arrays of controls or forms that are invalid with given error.</li>
</ul></div>
</ul>
</div></div>
</li>
</ul>
</div>

66
lib/angular/docs/partials/api/ng.directive:form.html Normal file → Executable file
View file

@ -1,77 +1,64 @@
<h1><code ng:non-bindable="">form</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/form.js#L211" 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/form.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">form</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/form.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p>Directive that instantiates
<div><h2 id="Description">Description</h2>
<div class="description"><div class="ng-directive-page ng-directive-form-page"><p>Directive that instantiates
<a href="api/ng.directive:form.FormController"><code>FormController</code></a>.</p>
<p>If <code>name</code> attribute is specified, the form controller is published onto the current scope under
this name.</p>
<h3>Alias: <a href="api/ng.directive:ngForm"><code><code>ngForm</code></code></a></h3>
<h3>Alias: <a href="api/ng.directive:ngForm"><code><code>ngForm</code></code></a></h1>
<p>In angular forms can be nested. This means that the outer form is valid when all of the child
forms are valid as well. However browsers do not allow nesting of <code>&lt;form&gt;</code> elements, for this
reason angular provides <a href="api/ng.directive:ngForm"><code><code>ngForm</code></code></a> alias
which behaves identical to <code>&lt;form&gt;</code> but allows form nesting.</p>
<h3>CSS classes</h3>
<h1>CSS classes</h1>
<ul>
<li><code>ng-valid</code> Is set if the form is valid.</li>
<li><code>ng-invalid</code> Is set if the form is invalid.</li>
<li><code>ng-pristine</code> Is set if the form is pristine.</li>
<li><code>ng-dirty</code> Is set if the form is dirty.</li>
</ul>
<h3>Submitting a form and preventing default action</h3>
<h1>Submitting a form and preventing default action</h3>
<p>Since the role of forms in client-side Angular applications is different than in classical
roundtrip apps, it is desirable for the browser not to translate the form submission into a full
page reload that sends the data to the server. Instead some javascript logic should be triggered
to handle the form submission in application specific way.</p>
<p>For this reason, Angular prevents the default action (form submission to the server) unless the
<code>&lt;form&gt;</code> element has an <code>action</code> attribute specified.</p>
<p>You can use one of the following two ways to specify what javascript method should be called when
a form is submitted:</p>
<ul>
<li><a href="api/ng.directive:ngSubmit"><code>ngSubmit</code></a> directive on the form element</li>
<li><a href="api/ng.directive:ngClick"><code>ngClick</code></a> directive on the first
button or input field of type submit (input[type=submit])</li>
</ul>
<p>To prevent double execution of the handler, use only one of ngSubmit or ngClick directives. This
is because of the following form submission rules coming from the html spec:</p>
<ul>
<li>If a form has only one input field then hitting enter in this field triggers form submit
(<code>ngSubmit</code>)</li>
<li>if a form has has 2+ input fields and no buttons or input[type=submit] then hitting enter
doesn't trigger submit</li>
doesn&#39;t trigger submit</li>
<li>if a form has one or more input fields and one or more buttons or input[type=submit] then
hitting enter in any of the input fields will trigger the click handler on the <em>first</em> button or
input[type=submit] (<code>ngClick</code>) <em>and</em> a submit handler on the enclosing form (<code>ngSubmit</code>)</li>
</ul></div>
</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">&lt;form
<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">&lt;form
[name="{string}"]&gt;
&lt;/form&gt;</pre>
<h3 id="Parameters">Parameters</h3>
<ul class="parameters"><li><code ng:non-bindable="">name<i>(optional)</i> {string=} </code>
<p>Name of the form. If specified, the form controller will be published into
related scope, under this name.</p></li>
</ul>
</div>
<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>name <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-form-page"><p>Name of the form. If specified, the form controller will be published into
related scope, under this name.</p>
</div></td></tr></tbody></table></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-101" source-edit-css="" source-edit-js="script.js-100" source-edit-unit="" source-edit-scenario="scenario.js-102"></div>
<div class="example"><div class="ng-directive-page ng-directive-form-page"><h4>Source</h2>
<div source-edit="" source-edit-deps="angular.js script.js" source-edit-html="index.html-14" source-edit-css="" source-edit-js="script.js-13" source-edit-json="" source-edit-unit="" source-edit-scenario="scenario.js-15"></div>
<div class="tabbable"><div class="tab-pane" title="index.html">
<pre class="prettyprint linenums" ng-set-text="index.html-101" ng-html-wrap=" angular.js script.js"></pre>
<script type="text/ng-template" id="index.html-101">
<pre class="prettyprint linenums" ng-set-text="index.html-14" ng-html-wrap=" angular.js script.js"></pre>
<script type="text/ng-template" id="index.html-14">
<form name="myForm" ng-controller="Ctrl">
userType: <input name="input" ng-model="userType" required>
@ -85,16 +72,16 @@ related scope, under this name.</p></li>
</script>
</div>
<div class="tab-pane" title="script.js">
<pre class="prettyprint linenums" ng-set-text="script.js-100"></pre>
<script type="text/ng-template" id="script.js-100">
<pre class="prettyprint linenums" ng-set-text="script.js-13"></pre>
<script type="text/ng-template" id="script.js-13">
function Ctrl($scope) {
$scope.userType = 'guest';
}
</script>
</div>
<div class="tab-pane" title="End to end test">
<pre class="prettyprint linenums" ng-set-text="scenario.js-102"></pre>
<script type="text/ng-template" id="scenario.js-102">
<pre class="prettyprint linenums" ng-set-text="scenario.js-15"></pre>
<script type="text/ng-template" id="scenario.js-15">
it('should initialize to model', function() {
expect(binding('userType')).toEqual('guest');
expect(binding('myForm.input.$valid')).toEqual('true');
@ -107,6 +94,7 @@ related scope, under this name.</p></li>
});
</script>
</div>
</div><h4>Demo</h4>
<div class="well doc-example-live animator-container" ng-embed-app="" ng-set-html="index.html-101" ng-eval-javascript="script.js-100"></div></div>
</div><h2>Demo</h4>
<div class="well doc-example-live animate-container" ng-embed-app="" ng-set-html="index.html-14" ng-eval-javascript="script.js-13"></div>
</div></div>
</div>

View file

@ -1,9 +1,11 @@
<h1><code ng:non-bindable="">input [checkbox]</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/input.js#L334" 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/input.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">input [checkbox]</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/input.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p>HTML checkbox.</p></div>
<div><h2 id="Description">Description</h2>
<div class="description"><div class="ng-directive-page ng-directive-input-checkbox-page"><p>HTML checkbox.</p>
</div></div>
<h2 id="Usage">Usage</h2>
<div class="usage"><pre class="prettyprint linenums">&lt;input type="checkbox"
ng-model="{string}"
@ -11,26 +13,19 @@
[ng-true-value="{string}"]
[ng-false-value="{string}"]
[ng-change="{string}"]&gt;</pre>
<h3 id="Parameters">Parameters</h3>
<ul class="parameters"><li><code ng:non-bindable="">ngModel {string} </code>
<p>Assignable angular expression to data-bind to.</p></li>
<li><code ng:non-bindable="">name<i>(optional)</i> {string=} </code>
<p>Property name of the form under which the control is published.</p></li>
<li><code ng:non-bindable="">ngTrueValue<i>(optional)</i> {string=} </code>
<p>The value to which the expression should be set when selected.</p></li>
<li><code ng:non-bindable="">ngFalseValue<i>(optional)</i> {string=} </code>
<p>The value to which the expression should be set when not selected.</p></li>
<li><code ng:non-bindable="">ngChange<i>(optional)</i> {string=} </code>
<p>Angular expression to be executed when input changes due to user
interaction with the input element.</p></li>
</ul>
</div>
<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>ngModel</td><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="ng-directive-page ng-directive-input-checkbox-page"><p>Assignable angular expression to data-bind to.</p>
</div></td></tr><tr><td>name <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-input-checkbox-page"><p>Property name of the form under which the control is published.</p>
</div></td></tr><tr><td>ngTrueValue <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-input-checkbox-page"><p>The value to which the expression should be set when selected.</p>
</div></td></tr><tr><td>ngFalseValue <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-input-checkbox-page"><p>The value to which the expression should be set when not selected.</p>
</div></td></tr><tr><td>ngChange <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-input-checkbox-page"><p>Angular expression to be executed when input changes due to user
interaction with the input element.</p>
</div></td></tr></tbody></table></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-134" source-edit-css="" source-edit-js="script.js-133" source-edit-unit="" source-edit-scenario="scenario.js-135"></div>
<div class="example"><div class="ng-directive-page ng-directive-input-checkbox-page"><h4>Source</h2>
<div source-edit="" source-edit-deps="angular.js script.js" source-edit-html="index.html-51" source-edit-css="" source-edit-js="script.js-50" source-edit-json="" source-edit-unit="" source-edit-scenario="scenario.js-52"></div>
<div class="tabbable"><div class="tab-pane" title="index.html">
<pre class="prettyprint linenums" ng-set-text="index.html-134" ng-html-wrap=" angular.js script.js"></pre>
<script type="text/ng-template" id="index.html-134">
<pre class="prettyprint linenums" ng-set-text="index.html-51" ng-html-wrap=" angular.js script.js"></pre>
<script type="text/ng-template" id="index.html-51">
<form name="myForm" ng-controller="Ctrl">
Value1: <input type="checkbox" ng-model="value1"> <br/>
@ -42,8 +37,8 @@ interaction with the input element.</p></li>
</script>
</div>
<div class="tab-pane" title="script.js">
<pre class="prettyprint linenums" ng-set-text="script.js-133"></pre>
<script type="text/ng-template" id="script.js-133">
<pre class="prettyprint linenums" ng-set-text="script.js-50"></pre>
<script type="text/ng-template" id="script.js-50">
function Ctrl($scope) {
$scope.value1 = true;
$scope.value2 = 'YES'
@ -51,8 +46,8 @@ interaction with the input element.</p></li>
</script>
</div>
<div class="tab-pane" title="End to end test">
<pre class="prettyprint linenums" ng-set-text="scenario.js-135"></pre>
<script type="text/ng-template" id="scenario.js-135">
<pre class="prettyprint linenums" ng-set-text="scenario.js-52"></pre>
<script type="text/ng-template" id="scenario.js-52">
it('should change state', function() {
expect(binding('value1')).toEqual('true');
expect(binding('value2')).toEqual('YES');
@ -64,6 +59,7 @@ interaction with the input element.</p></li>
});
</script>
</div>
</div><h4>Demo</h4>
<div class="well doc-example-live animator-container" ng-embed-app="" ng-set-html="index.html-134" ng-eval-javascript="script.js-133"></div></div>
</div><h2>Demo</h4>
<div class="well doc-example-live animate-container" ng-embed-app="" ng-set-html="index.html-51" ng-eval-javascript="script.js-50"></div>
</div></div>
</div>

View file

@ -1,10 +1,12 @@
<h1><code ng:non-bindable="">input [email]</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/input.js#L225" 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/input.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">input [email]</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/input.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p>Text input with email validation. Sets the <code>email</code> validation error key if not a valid email
address.</p></div>
<div><h2 id="Description">Description</h2>
<div class="description"><div class="ng-directive-page ng-directive-input-email-page"><p>Text input with email validation. Sets the <code>email</code> validation error key if not a valid email
address.</p>
</div></div>
<h2 id="Usage">Usage</h2>
<div class="usage"><pre class="prettyprint linenums">&lt;input type="email"
ng-model="{string}"
@ -13,36 +15,30 @@ address.</p></div>
[ng-required="{string}"]
[ng-minlength="{number}"]
[ng-maxlength="{number}"]
[ng-pattern="{string}"]&gt;</pre>
<h3 id="Parameters">Parameters</h3>
<ul class="parameters"><li><code ng:non-bindable="">ngModel {string} </code>
<p>Assignable angular expression to data-bind to.</p></li>
<li><code ng:non-bindable="">name<i>(optional)</i> {string=} </code>
<p>Property name of the form under which the control is published.</p></li>
<li><code ng:non-bindable="">required<i>(optional)</i> {string=} </code>
<p>Sets <code>required</code> validation error key if the value is not entered.</p></li>
<li><code ng:non-bindable="">ngRequired<i>(optional)</i> {string=} </code>
<p>Adds <code>required</code> attribute and <code>required</code> validation constraint to
[ng-pattern="{string}"]
[ng-change="{string}"]&gt;</pre>
<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>ngModel</td><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="ng-directive-page ng-directive-input-email-page"><p>Assignable angular expression to data-bind to.</p>
</div></td></tr><tr><td>name <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-input-email-page"><p>Property name of the form under which the control is published.</p>
</div></td></tr><tr><td>required <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-input-email-page"><p>Sets <code>required</code> validation error key if the value is not entered.</p>
</div></td></tr><tr><td>ngRequired <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-input-email-page"><p>Adds <code>required</code> attribute and <code>required</code> validation constraint to
the element when the ngRequired expression evaluates to true. Use <code>ngRequired</code> instead of
<code>required</code> when you want to data-bind to the <code>required</code> attribute.</p></li>
<li><code ng:non-bindable="">ngMinlength<i>(optional)</i> {number=} </code>
<p>Sets <code>minlength</code> validation error key if the value is shorter than
minlength.</p></li>
<li><code ng:non-bindable="">ngMaxlength<i>(optional)</i> {number=} </code>
<p>Sets <code>maxlength</code> validation error key if the value is longer than
maxlength.</p></li>
<li><code ng:non-bindable="">ngPattern<i>(optional)</i> {string=} </code>
<p>Sets <code>pattern</code> validation error key if the value does not match the
<code>required</code> when you want to data-bind to the <code>required</code> attribute.</p>
</div></td></tr><tr><td>ngMinlength <div><em>(optional)</em></div></td><td><a href="" class="label type-hint type-hint-number">number</a></td><td><div class="ng-directive-page ng-directive-input-email-page"><p>Sets <code>minlength</code> validation error key if the value is shorter than
minlength.</p>
</div></td></tr><tr><td>ngMaxlength <div><em>(optional)</em></div></td><td><a href="" class="label type-hint type-hint-number">number</a></td><td><div class="ng-directive-page ng-directive-input-email-page"><p>Sets <code>maxlength</code> validation error key if the value is longer than
maxlength.</p>
</div></td></tr><tr><td>ngPattern <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-input-email-page"><p>Sets <code>pattern</code> validation error key if the value does not match the
RegExp pattern expression. Expected value is <code>/regexp/</code> for inline patterns or <code>regexp</code> for
patterns defined as scope expressions.</p></li>
</ul>
</div>
patterns defined as scope expressions.</p>
</div></td></tr><tr><td>ngChange <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-input-email-page"><p>Angular expression to be executed when input changes due to user
interaction with the input element.</p>
</div></td></tr></tbody></table></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-128" source-edit-css="" source-edit-js="script.js-127" source-edit-unit="" source-edit-scenario="scenario.js-129"></div>
<div class="example"><div class="ng-directive-page ng-directive-input-email-page"><h4>Source</h2>
<div source-edit="" source-edit-deps="angular.js script.js" source-edit-html="index.html-45" source-edit-css="" source-edit-js="script.js-44" source-edit-json="" source-edit-unit="" source-edit-scenario="scenario.js-46"></div>
<div class="tabbable"><div class="tab-pane" title="index.html">
<pre class="prettyprint linenums" ng-set-text="index.html-128" ng-html-wrap=" angular.js script.js"></pre>
<script type="text/ng-template" id="index.html-128">
<pre class="prettyprint linenums" ng-set-text="index.html-45" ng-html-wrap=" angular.js script.js"></pre>
<script type="text/ng-template" id="index.html-45">
<form name="myForm" ng-controller="Ctrl">
Email: <input type="email" name="input" ng-model="text" required>
@ -60,16 +56,16 @@ patterns defined as scope expressions.</p></li>
</script>
</div>
<div class="tab-pane" title="script.js">
<pre class="prettyprint linenums" ng-set-text="script.js-127"></pre>
<script type="text/ng-template" id="script.js-127">
<pre class="prettyprint linenums" ng-set-text="script.js-44"></pre>
<script type="text/ng-template" id="script.js-44">
function Ctrl($scope) {
$scope.text = 'me@example.com';
}
</script>
</div>
<div class="tab-pane" title="End to end test">
<pre class="prettyprint linenums" ng-set-text="scenario.js-129"></pre>
<script type="text/ng-template" id="scenario.js-129">
<pre class="prettyprint linenums" ng-set-text="scenario.js-46"></pre>
<script type="text/ng-template" id="scenario.js-46">
it('should initialize to model', function() {
expect(binding('text')).toEqual('me@example.com');
expect(binding('myForm.input.$valid')).toEqual('true');
@ -87,6 +83,7 @@ patterns defined as scope expressions.</p></li>
});
</script>
</div>
</div><h4>Demo</h4>
<div class="well doc-example-live animator-container" ng-embed-app="" ng-set-html="index.html-128" ng-eval-javascript="script.js-127"></div></div>
</div><h2>Demo</h4>
<div class="well doc-example-live animate-container" ng-embed-app="" ng-set-html="index.html-45" ng-eval-javascript="script.js-44"></div>
</div></div>
</div>

75
lib/angular/docs/partials/api/ng.directive:input.html Normal file → Executable file
View file

@ -1,12 +1,14 @@
<h1><code ng:non-bindable="">input</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/input.js#L698" 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/input.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">input</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/input.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p>HTML input element control with angular data-binding. Input control follows HTML5 input types
and polyfills the HTML5 validation behavior for older browsers.</p></div>
<div><h2 id="Description">Description</h2>
<div class="description"><div class="ng-directive-page ng-directive-input-page"><p>HTML input element control with angular data-binding. Input control follows HTML5 input types
and polyfills the HTML5 validation behavior for older browsers.</p>
</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">&lt;input
<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">&lt;input
ngModel="{string}"
[name="{string}"]
[required]
@ -16,36 +18,26 @@ and polyfills the HTML5 validation behavior for older browsers.</p></div>
[ngPattern="{string}"]
[ngChange="{string}"]&gt;
&lt;/input&gt;</pre>
<h3 id="Parameters">Parameters</h3>
<ul class="parameters"><li><code ng:non-bindable="">ngModel {string} </code>
<p>Assignable angular expression to data-bind to.</p></li>
<li><code ng:non-bindable="">name<i>(optional)</i> {string=} </code>
<p>Property name of the form under which the control is published.</p></li>
<li><code ng:non-bindable="">required<i>(optional)</i> {string=} </code>
<p>Sets <code>required</code> validation error key if the value is not entered.</p></li>
<li><code ng:non-bindable="">ngRequired<i>(optional)</i> {boolean=} </code>
<p>Sets <code>required</code> attribute if set to true</p></li>
<li><code ng:non-bindable="">ngMinlength<i>(optional)</i> {number=} </code>
<p>Sets <code>minlength</code> validation error key if the value is shorter than
minlength.</p></li>
<li><code ng:non-bindable="">ngMaxlength<i>(optional)</i> {number=} </code>
<p>Sets <code>maxlength</code> validation error key if the value is longer than
maxlength.</p></li>
<li><code ng:non-bindable="">ngPattern<i>(optional)</i> {string=} </code>
<p>Sets <code>pattern</code> validation error key if the value does not match the
<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>ngModel</td><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="ng-directive-page ng-directive-input-page"><p>Assignable angular expression to data-bind to.</p>
</div></td></tr><tr><td>name <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-input-page"><p>Property name of the form under which the control is published.</p>
</div></td></tr><tr><td>required <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-input-page"><p>Sets <code>required</code> validation error key if the value is not entered.</p>
</div></td></tr><tr><td>ngRequired <div><em>(optional)</em></div></td><td><a href="" class="label type-hint type-hint-boolean">boolean</a></td><td><div class="ng-directive-page ng-directive-input-page"><p>Sets <code>required</code> attribute if set to true</p>
</div></td></tr><tr><td>ngMinlength <div><em>(optional)</em></div></td><td><a href="" class="label type-hint type-hint-number">number</a></td><td><div class="ng-directive-page ng-directive-input-page"><p>Sets <code>minlength</code> validation error key if the value is shorter than
minlength.</p>
</div></td></tr><tr><td>ngMaxlength <div><em>(optional)</em></div></td><td><a href="" class="label type-hint type-hint-number">number</a></td><td><div class="ng-directive-page ng-directive-input-page"><p>Sets <code>maxlength</code> validation error key if the value is longer than
maxlength.</p>
</div></td></tr><tr><td>ngPattern <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-input-page"><p>Sets <code>pattern</code> validation error key if the value does not match the
RegExp pattern expression. Expected value is <code>/regexp/</code> for inline patterns or <code>regexp</code> for
patterns defined as scope expressions.</p></li>
<li><code ng:non-bindable="">ngChange<i>(optional)</i> {string=} </code>
<p>Angular expression to be executed when input changes due to user
interaction with the input element.</p></li>
</ul>
</div>
patterns defined as scope expressions.</p>
</div></td></tr><tr><td>ngChange <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-input-page"><p>Angular expression to be executed when input changes due to user
interaction with the input element.</p>
</div></td></tr></tbody></table></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-137" source-edit-css="" source-edit-js="script.js-136" source-edit-unit="" source-edit-scenario="scenario.js-138"></div>
<div class="example"><div class="ng-directive-page ng-directive-input-page"><h4>Source</h2>
<div source-edit="" source-edit-deps="angular.js script.js" source-edit-html="index.html-54" source-edit-css="" source-edit-js="script.js-53" source-edit-json="" source-edit-unit="" source-edit-scenario="scenario.js-55"></div>
<div class="tabbable"><div class="tab-pane" title="index.html">
<pre class="prettyprint linenums" ng-set-text="index.html-137" ng-html-wrap=" angular.js script.js"></pre>
<script type="text/ng-template" id="index.html-137">
<pre class="prettyprint linenums" ng-set-text="index.html-54" ng-html-wrap=" angular.js script.js"></pre>
<script type="text/ng-template" id="index.html-54">
<div ng-controller="Ctrl">
<form name="myForm">
@ -64,7 +56,7 @@ interaction with the input element.</p></li>
<tt>myForm.userName.$valid = {{myForm.userName.$valid}}</tt><br>
<tt>myForm.userName.$error = {{myForm.userName.$error}}</tt><br>
<tt>myForm.lastName.$valid = {{myForm.lastName.$valid}}</tt><br>
<tt>myForm.userName.$error = {{myForm.lastName.$error}}</tt><br>
<tt>myForm.lastName.$error = {{myForm.lastName.$error}}</tt><br>
<tt>myForm.$valid = {{myForm.$valid}}</tt><br>
<tt>myForm.$error.required = {{!!myForm.$error.required}}</tt><br>
<tt>myForm.$error.minlength = {{!!myForm.$error.minlength}}</tt><br>
@ -73,16 +65,16 @@ interaction with the input element.</p></li>
</script>
</div>
<div class="tab-pane" title="script.js">
<pre class="prettyprint linenums" ng-set-text="script.js-136"></pre>
<script type="text/ng-template" id="script.js-136">
<pre class="prettyprint linenums" ng-set-text="script.js-53"></pre>
<script type="text/ng-template" id="script.js-53">
function Ctrl($scope) {
$scope.user = {name: 'guest', last: 'visitor'};
}
</script>
</div>
<div class="tab-pane" title="End to end test">
<pre class="prettyprint linenums" ng-set-text="scenario.js-138"></pre>
<script type="text/ng-template" id="scenario.js-138">
<pre class="prettyprint linenums" ng-set-text="scenario.js-55"></pre>
<script type="text/ng-template" id="scenario.js-55">
it('should initialize to model', function() {
expect(binding('user')).toEqual('{"name":"guest","last":"visitor"}');
expect(binding('myForm.userName.$valid')).toEqual('true');
@ -121,6 +113,7 @@ interaction with the input element.</p></li>
});
</script>
</div>
</div><h4>Demo</h4>
<div class="well doc-example-live animator-container" ng-embed-app="" ng-set-html="index.html-137" ng-eval-javascript="script.js-136"></div></div>
</div><h2>Demo</h4>
<div class="well doc-example-live animate-container" ng-embed-app="" ng-set-html="index.html-54" ng-eval-javascript="script.js-53"></div>
</div></div>
</div>

View file

@ -1,10 +1,12 @@
<h1><code ng:non-bindable="">input [number]</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/input.js#L86" 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/input.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">input [number]</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/input.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p>Text input with number validation and transformation. Sets the <code>number</code> validation
error if not a valid number.</p></div>
<div><h2 id="Description">Description</h2>
<div class="description"><div class="ng-directive-page ng-directive-input-number-page"><p>Text input with number validation and transformation. Sets the <code>number</code> validation
error if not a valid number.</p>
</div></div>
<h2 id="Usage">Usage</h2>
<div class="usage"><pre class="prettyprint linenums">&lt;input type="number"
ng-model="{string}"
@ -17,49 +19,37 @@ error if not a valid number.</p></div>
[ng-maxlength="{number}"]
[ng-pattern="{string}"]
[ng-change="{string}"]&gt;</pre>
<h3 id="Parameters">Parameters</h3>
<ul class="parameters"><li><code ng:non-bindable="">ngModel {string} </code>
<p>Assignable angular expression to data-bind to.</p></li>
<li><code ng:non-bindable="">name<i>(optional)</i> {string=} </code>
<p>Property name of the form under which the control is published.</p></li>
<li><code ng:non-bindable="">min<i>(optional)</i> {string=} </code>
<p>Sets the <code>min</code> validation error key if the value entered is less then <code>min</code>.</p></li>
<li><code ng:non-bindable="">max<i>(optional)</i> {string=} </code>
<p>Sets the <code>max</code> validation error key if the value entered is greater then <code>min</code>.</p></li>
<li><code ng:non-bindable="">required<i>(optional)</i> {string=} </code>
<p>Sets <code>required</code> validation error key if the value is not entered.</p></li>
<li><code ng:non-bindable="">ngRequired<i>(optional)</i> {string=} </code>
<p>Adds <code>required</code> attribute and <code>required</code> validation constraint to
<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>ngModel</td><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="ng-directive-page ng-directive-input-number-page"><p>Assignable angular expression to data-bind to.</p>
</div></td></tr><tr><td>name <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-input-number-page"><p>Property name of the form under which the control is published.</p>
</div></td></tr><tr><td>min <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-input-number-page"><p>Sets the <code>min</code> validation error key if the value entered is less than <code>min</code>.</p>
</div></td></tr><tr><td>max <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-input-number-page"><p>Sets the <code>max</code> validation error key if the value entered is greater than <code>max</code>.</p>
</div></td></tr><tr><td>required <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-input-number-page"><p>Sets <code>required</code> validation error key if the value is not entered.</p>
</div></td></tr><tr><td>ngRequired <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-input-number-page"><p>Adds <code>required</code> attribute and <code>required</code> validation constraint to
the element when the ngRequired expression evaluates to true. Use <code>ngRequired</code> instead of
<code>required</code> when you want to data-bind to the <code>required</code> attribute.</p></li>
<li><code ng:non-bindable="">ngMinlength<i>(optional)</i> {number=} </code>
<p>Sets <code>minlength</code> validation error key if the value is shorter than
minlength.</p></li>
<li><code ng:non-bindable="">ngMaxlength<i>(optional)</i> {number=} </code>
<p>Sets <code>maxlength</code> validation error key if the value is longer than
maxlength.</p></li>
<li><code ng:non-bindable="">ngPattern<i>(optional)</i> {string=} </code>
<p>Sets <code>pattern</code> validation error key if the value does not match the
<code>required</code> when you want to data-bind to the <code>required</code> attribute.</p>
</div></td></tr><tr><td>ngMinlength <div><em>(optional)</em></div></td><td><a href="" class="label type-hint type-hint-number">number</a></td><td><div class="ng-directive-page ng-directive-input-number-page"><p>Sets <code>minlength</code> validation error key if the value is shorter than
minlength.</p>
</div></td></tr><tr><td>ngMaxlength <div><em>(optional)</em></div></td><td><a href="" class="label type-hint type-hint-number">number</a></td><td><div class="ng-directive-page ng-directive-input-number-page"><p>Sets <code>maxlength</code> validation error key if the value is longer than
maxlength.</p>
</div></td></tr><tr><td>ngPattern <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-input-number-page"><p>Sets <code>pattern</code> validation error key if the value does not match the
RegExp pattern expression. Expected value is <code>/regexp/</code> for inline patterns or <code>regexp</code> for
patterns defined as scope expressions.</p></li>
<li><code ng:non-bindable="">ngChange<i>(optional)</i> {string=} </code>
<p>Angular expression to be executed when input changes due to user
interaction with the input element.</p></li>
</ul>
</div>
patterns defined as scope expressions.</p>
</div></td></tr><tr><td>ngChange <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-input-number-page"><p>Angular expression to be executed when input changes due to user
interaction with the input element.</p>
</div></td></tr></tbody></table></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-122" source-edit-css="" source-edit-js="script.js-121" source-edit-unit="" source-edit-scenario="scenario.js-123"></div>
<div class="example"><div class="ng-directive-page ng-directive-input-number-page"><h4>Source</h2>
<div source-edit="" source-edit-deps="angular.js script.js" source-edit-html="index.html-39" source-edit-css="" source-edit-js="script.js-38" source-edit-json="" source-edit-unit="" source-edit-scenario="scenario.js-40"></div>
<div class="tabbable"><div class="tab-pane" title="index.html">
<pre class="prettyprint linenums" ng-set-text="index.html-122" ng-html-wrap=" angular.js script.js"></pre>
<script type="text/ng-template" id="index.html-122">
<pre class="prettyprint linenums" ng-set-text="index.html-39" ng-html-wrap=" angular.js script.js"></pre>
<script type="text/ng-template" id="index.html-39">
<form name="myForm" ng-controller="Ctrl">
Number: <input type="number" name="input" ng-model="value"
min="0" max="99" required>
<span class="error" ng-show="myForm.list.$error.required">
<span class="error" ng-show="myForm.input.$error.required">
Required!</span>
<span class="error" ng-show="myForm.list.$error.number">
<span class="error" ng-show="myForm.input.$error.number">
Not valid number!</span>
<tt>value = {{value}}</tt><br/>
<tt>myForm.input.$valid = {{myForm.input.$valid}}</tt><br/>
@ -70,16 +60,16 @@ interaction with the input element.</p></li>
</script>
</div>
<div class="tab-pane" title="script.js">
<pre class="prettyprint linenums" ng-set-text="script.js-121"></pre>
<script type="text/ng-template" id="script.js-121">
<pre class="prettyprint linenums" ng-set-text="script.js-38"></pre>
<script type="text/ng-template" id="script.js-38">
function Ctrl($scope) {
$scope.value = 12;
}
</script>
</div>
<div class="tab-pane" title="End to end test">
<pre class="prettyprint linenums" ng-set-text="scenario.js-123"></pre>
<script type="text/ng-template" id="scenario.js-123">
<pre class="prettyprint linenums" ng-set-text="scenario.js-40"></pre>
<script type="text/ng-template" id="scenario.js-40">
it('should initialize to model', function() {
expect(binding('value')).toEqual('12');
expect(binding('myForm.input.$valid')).toEqual('true');
@ -98,6 +88,7 @@ interaction with the input element.</p></li>
});
</script>
</div>
</div><h4>Demo</h4>
<div class="well doc-example-live animator-container" ng-embed-app="" ng-set-html="index.html-122" ng-eval-javascript="script.js-121"></div></div>
</div><h2>Demo</h4>
<div class="well doc-example-live animate-container" ng-embed-app="" ng-set-html="index.html-39" ng-eval-javascript="script.js-38"></div>
</div></div>
</div>

View file

@ -1,33 +1,29 @@
<h1><code ng:non-bindable="">input [radio]</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/input.js#L293" 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/input.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">input [radio]</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/input.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p>HTML radio button.</p></div>
<div><h2 id="Description">Description</h2>
<div class="description"><div class="ng-directive-page ng-directive-input-radio-page"><p>HTML radio button.</p>
</div></div>
<h2 id="Usage">Usage</h2>
<div class="usage"><pre class="prettyprint linenums">&lt;input type="radio"
ng-model="{string}"
value="{string}"
[name="{string}"]
[ng-change="{string}"]&gt;</pre>
<h3 id="Parameters">Parameters</h3>
<ul class="parameters"><li><code ng:non-bindable="">ngModel {string} </code>
<p>Assignable angular expression to data-bind to.</p></li>
<li><code ng:non-bindable="">value {string} </code>
<p>The value to which the expression should be set when selected.</p></li>
<li><code ng:non-bindable="">name<i>(optional)</i> {string=} </code>
<p>Property name of the form under which the control is published.</p></li>
<li><code ng:non-bindable="">ngChange<i>(optional)</i> {string=} </code>
<p>Angular expression to be executed when input changes due to user
interaction with the input element.</p></li>
</ul>
</div>
<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>ngModel</td><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="ng-directive-page ng-directive-input-radio-page"><p>Assignable angular expression to data-bind to.</p>
</div></td></tr><tr><td>value</td><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="ng-directive-page ng-directive-input-radio-page"><p>The value to which the expression should be set when selected.</p>
</div></td></tr><tr><td>name <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-input-radio-page"><p>Property name of the form under which the control is published.</p>
</div></td></tr><tr><td>ngChange <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-input-radio-page"><p>Angular expression to be executed when input changes due to user
interaction with the input element.</p>
</div></td></tr></tbody></table></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-131" source-edit-css="" source-edit-js="script.js-130" source-edit-unit="" source-edit-scenario="scenario.js-132"></div>
<div class="example"><div class="ng-directive-page ng-directive-input-radio-page"><h4>Source</h2>
<div source-edit="" source-edit-deps="angular.js script.js" source-edit-html="index.html-48" source-edit-css="" source-edit-js="script.js-47" source-edit-json="" source-edit-unit="" source-edit-scenario="scenario.js-49"></div>
<div class="tabbable"><div class="tab-pane" title="index.html">
<pre class="prettyprint linenums" ng-set-text="index.html-131" ng-html-wrap=" angular.js script.js"></pre>
<script type="text/ng-template" id="index.html-131">
<pre class="prettyprint linenums" ng-set-text="index.html-48" ng-html-wrap=" angular.js script.js"></pre>
<script type="text/ng-template" id="index.html-48">
<form name="myForm" ng-controller="Ctrl">
<input type="radio" ng-model="color" value="red"> Red <br/>
@ -38,16 +34,16 @@ interaction with the input element.</p></li>
</script>
</div>
<div class="tab-pane" title="script.js">
<pre class="prettyprint linenums" ng-set-text="script.js-130"></pre>
<script type="text/ng-template" id="script.js-130">
<pre class="prettyprint linenums" ng-set-text="script.js-47"></pre>
<script type="text/ng-template" id="script.js-47">
function Ctrl($scope) {
$scope.color = 'blue';
}
</script>
</div>
<div class="tab-pane" title="End to end test">
<pre class="prettyprint linenums" ng-set-text="scenario.js-132"></pre>
<script type="text/ng-template" id="scenario.js-132">
<pre class="prettyprint linenums" ng-set-text="scenario.js-49"></pre>
<script type="text/ng-template" id="scenario.js-49">
it('should change state', function() {
expect(binding('color')).toEqual('blue');
@ -56,6 +52,7 @@ interaction with the input element.</p></li>
});
</script>
</div>
</div><h4>Demo</h4>
<div class="well doc-example-live animator-container" ng-embed-app="" ng-set-html="index.html-131" ng-eval-javascript="script.js-130"></div></div>
</div><h2>Demo</h4>
<div class="well doc-example-live animate-container" ng-embed-app="" ng-set-html="index.html-48" ng-eval-javascript="script.js-47"></div>
</div></div>
</div>

View file

@ -1,9 +1,11 @@
<h1><code ng:non-bindable="">input [text]</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/input.js#L9" 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/input.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">input [text]</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/input.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p>Standard HTML text input with angular data binding.</p></div>
<div><h2 id="Description">Description</h2>
<div class="description"><div class="ng-directive-page ng-directive-input-text-page"><p>Standard HTML text input with angular data binding.</p>
</div></div>
<h2 id="Usage">Usage</h2>
<div class="usage"><pre class="prettyprint linenums">&lt;input type="text"
ng-model="{string}"
@ -15,41 +17,30 @@
[ng-pattern="{string}"]
[ng-change="{string}"]
[ng-trim="{boolean}"]&gt;</pre>
<h3 id="Parameters">Parameters</h3>
<ul class="parameters"><li><code ng:non-bindable="">ngModel {string} </code>
<p>Assignable angular expression to data-bind to.</p></li>
<li><code ng:non-bindable="">name<i>(optional)</i> {string=} </code>
<p>Property name of the form under which the control is published.</p></li>
<li><code ng:non-bindable="">required<i>(optional)</i> {string=} </code>
<p>Adds <code>required</code> validation error key if the value is not entered.</p></li>
<li><code ng:non-bindable="">ngRequired<i>(optional)</i> {string=} </code>
<p>Adds <code>required</code> attribute and <code>required</code> validation constraint to
<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>ngModel</td><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="ng-directive-page ng-directive-input-text-page"><p>Assignable angular expression to data-bind to.</p>
</div></td></tr><tr><td>name <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-input-text-page"><p>Property name of the form under which the control is published.</p>
</div></td></tr><tr><td>required <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-input-text-page"><p>Adds <code>required</code> validation error key if the value is not entered.</p>
</div></td></tr><tr><td>ngRequired <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-input-text-page"><p>Adds <code>required</code> attribute and <code>required</code> validation constraint to
the element when the ngRequired expression evaluates to true. Use <code>ngRequired</code> instead of
<code>required</code> when you want to data-bind to the <code>required</code> attribute.</p></li>
<li><code ng:non-bindable="">ngMinlength<i>(optional)</i> {number=} </code>
<p>Sets <code>minlength</code> validation error key if the value is shorter than
minlength.</p></li>
<li><code ng:non-bindable="">ngMaxlength<i>(optional)</i> {number=} </code>
<p>Sets <code>maxlength</code> validation error key if the value is longer than
maxlength.</p></li>
<li><code ng:non-bindable="">ngPattern<i>(optional)</i> {string=} </code>
<p>Sets <code>pattern</code> validation error key if the value does not match the
<code>required</code> when you want to data-bind to the <code>required</code> attribute.</p>
</div></td></tr><tr><td>ngMinlength <div><em>(optional)</em></div></td><td><a href="" class="label type-hint type-hint-number">number</a></td><td><div class="ng-directive-page ng-directive-input-text-page"><p>Sets <code>minlength</code> validation error key if the value is shorter than
minlength.</p>
</div></td></tr><tr><td>ngMaxlength <div><em>(optional)</em></div></td><td><a href="" class="label type-hint type-hint-number">number</a></td><td><div class="ng-directive-page ng-directive-input-text-page"><p>Sets <code>maxlength</code> validation error key if the value is longer than
maxlength.</p>
</div></td></tr><tr><td>ngPattern <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-input-text-page"><p>Sets <code>pattern</code> validation error key if the value does not match the
RegExp pattern expression. Expected value is <code>/regexp/</code> for inline patterns or <code>regexp</code> for
patterns defined as scope expressions.</p></li>
<li><code ng:non-bindable="">ngChange<i>(optional)</i> {string=} </code>
<p>Angular expression to be executed when input changes due to user
interaction with the input element.</p></li>
<li><code ng:non-bindable="">ngTrim<i>(optional=true)</i> {boolean=} </code>
<p>If set to false Angular will not automatically trimming the
input.</p></li>
</ul>
</div>
patterns defined as scope expressions.</p>
</div></td></tr><tr><td>ngChange <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-input-text-page"><p>Angular expression to be executed when input changes due to user
interaction with the input element.</p>
</div></td></tr><tr><td>ngTrim <div><em>(optional)</em></div></td><td><a href="" class="label type-hint type-hint-boolean">boolean</a></td><td><div class="ng-directive-page ng-directive-input-text-page"><p>If set to false Angular will not automatically trimming the
input.</p>
</div></td></tr></tbody></table></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-119" source-edit-css="" source-edit-js="script.js-118" source-edit-unit="" source-edit-scenario="scenario.js-120"></div>
<div class="example"><div class="ng-directive-page ng-directive-input-text-page"><h4>Source</h2>
<div source-edit="" source-edit-deps="angular.js script.js" source-edit-html="index.html-36" source-edit-css="" source-edit-js="script.js-35" source-edit-json="" source-edit-unit="" source-edit-scenario="scenario.js-37"></div>
<div class="tabbable"><div class="tab-pane" title="index.html">
<pre class="prettyprint linenums" ng-set-text="index.html-119" ng-html-wrap=" angular.js script.js"></pre>
<script type="text/ng-template" id="index.html-119">
<pre class="prettyprint linenums" ng-set-text="index.html-36" ng-html-wrap=" angular.js script.js"></pre>
<script type="text/ng-template" id="index.html-36">
<form name="myForm" ng-controller="Ctrl">
Single word: <input type="text" name="input" ng-model="text"
@ -68,8 +59,8 @@ input.</p></li>
</script>
</div>
<div class="tab-pane" title="script.js">
<pre class="prettyprint linenums" ng-set-text="script.js-118"></pre>
<script type="text/ng-template" id="script.js-118">
<pre class="prettyprint linenums" ng-set-text="script.js-35"></pre>
<script type="text/ng-template" id="script.js-35">
function Ctrl($scope) {
$scope.text = 'guest';
$scope.word = /^\s*\w*\s*$/;
@ -77,8 +68,8 @@ input.</p></li>
</script>
</div>
<div class="tab-pane" title="End to end test">
<pre class="prettyprint linenums" ng-set-text="scenario.js-120"></pre>
<script type="text/ng-template" id="scenario.js-120">
<pre class="prettyprint linenums" ng-set-text="scenario.js-37"></pre>
<script type="text/ng-template" id="scenario.js-37">
it('should initialize to model', function() {
expect(binding('text')).toEqual('guest');
expect(binding('myForm.input.$valid')).toEqual('true');
@ -102,6 +93,7 @@ input.</p></li>
});
</script>
</div>
</div><h4>Demo</h4>
<div class="well doc-example-live animator-container" ng-embed-app="" ng-set-html="index.html-119" ng-eval-javascript="script.js-118"></div></div>
</div><h2>Demo</h4>
<div class="well doc-example-live animate-container" ng-embed-app="" ng-set-html="index.html-36" ng-eval-javascript="script.js-35"></div>
</div></div>
</div>

View file

@ -1,10 +1,12 @@
<h1><code ng:non-bindable="">input [url]</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/input.js#L157" 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/input.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">input [url]</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/input.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p>Text input with URL validation. Sets the <code>url</code> validation error key if the content is not a
valid URL.</p></div>
<div><h2 id="Description">Description</h2>
<div class="description"><div class="ng-directive-page ng-directive-input-url-page"><p>Text input with URL validation. Sets the <code>url</code> validation error key if the content is not a
valid URL.</p>
</div></div>
<h2 id="Usage">Usage</h2>
<div class="usage"><pre class="prettyprint linenums">&lt;input type="url"
ng-model="{string}"
@ -15,38 +17,28 @@ valid URL.</p></div>
[ng-maxlength="{number}"]
[ng-pattern="{string}"]
[ng-change="{string}"]&gt;</pre>
<h3 id="Parameters">Parameters</h3>
<ul class="parameters"><li><code ng:non-bindable="">ngModel {string} </code>
<p>Assignable angular expression to data-bind to.</p></li>
<li><code ng:non-bindable="">name<i>(optional)</i> {string=} </code>
<p>Property name of the form under which the control is published.</p></li>
<li><code ng:non-bindable="">required<i>(optional)</i> {string=} </code>
<p>Sets <code>required</code> validation error key if the value is not entered.</p></li>
<li><code ng:non-bindable="">ngRequired<i>(optional)</i> {string=} </code>
<p>Adds <code>required</code> attribute and <code>required</code> validation constraint to
<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>ngModel</td><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="ng-directive-page ng-directive-input-url-page"><p>Assignable angular expression to data-bind to.</p>
</div></td></tr><tr><td>name <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-input-url-page"><p>Property name of the form under which the control is published.</p>
</div></td></tr><tr><td>required <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-input-url-page"><p>Sets <code>required</code> validation error key if the value is not entered.</p>
</div></td></tr><tr><td>ngRequired <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-input-url-page"><p>Adds <code>required</code> attribute and <code>required</code> validation constraint to
the element when the ngRequired expression evaluates to true. Use <code>ngRequired</code> instead of
<code>required</code> when you want to data-bind to the <code>required</code> attribute.</p></li>
<li><code ng:non-bindable="">ngMinlength<i>(optional)</i> {number=} </code>
<p>Sets <code>minlength</code> validation error key if the value is shorter than
minlength.</p></li>
<li><code ng:non-bindable="">ngMaxlength<i>(optional)</i> {number=} </code>
<p>Sets <code>maxlength</code> validation error key if the value is longer than
maxlength.</p></li>
<li><code ng:non-bindable="">ngPattern<i>(optional)</i> {string=} </code>
<p>Sets <code>pattern</code> validation error key if the value does not match the
<code>required</code> when you want to data-bind to the <code>required</code> attribute.</p>
</div></td></tr><tr><td>ngMinlength <div><em>(optional)</em></div></td><td><a href="" class="label type-hint type-hint-number">number</a></td><td><div class="ng-directive-page ng-directive-input-url-page"><p>Sets <code>minlength</code> validation error key if the value is shorter than
minlength.</p>
</div></td></tr><tr><td>ngMaxlength <div><em>(optional)</em></div></td><td><a href="" class="label type-hint type-hint-number">number</a></td><td><div class="ng-directive-page ng-directive-input-url-page"><p>Sets <code>maxlength</code> validation error key if the value is longer than
maxlength.</p>
</div></td></tr><tr><td>ngPattern <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-input-url-page"><p>Sets <code>pattern</code> validation error key if the value does not match the
RegExp pattern expression. Expected value is <code>/regexp/</code> for inline patterns or <code>regexp</code> for
patterns defined as scope expressions.</p></li>
<li><code ng:non-bindable="">ngChange<i>(optional)</i> {string=} </code>
<p>Angular expression to be executed when input changes due to user
interaction with the input element.</p></li>
</ul>
</div>
patterns defined as scope expressions.</p>
</div></td></tr><tr><td>ngChange <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-input-url-page"><p>Angular expression to be executed when input changes due to user
interaction with the input element.</p>
</div></td></tr></tbody></table></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-125" source-edit-css="" source-edit-js="script.js-124" source-edit-unit="" source-edit-scenario="scenario.js-126"></div>
<div class="example"><div class="ng-directive-page ng-directive-input-url-page"><h4>Source</h2>
<div source-edit="" source-edit-deps="angular.js script.js" source-edit-html="index.html-42" source-edit-css="" source-edit-js="script.js-41" source-edit-json="" source-edit-unit="" source-edit-scenario="scenario.js-43"></div>
<div class="tabbable"><div class="tab-pane" title="index.html">
<pre class="prettyprint linenums" ng-set-text="index.html-125" ng-html-wrap=" angular.js script.js"></pre>
<script type="text/ng-template" id="index.html-125">
<pre class="prettyprint linenums" ng-set-text="index.html-42" ng-html-wrap=" angular.js script.js"></pre>
<script type="text/ng-template" id="index.html-42">
<form name="myForm" ng-controller="Ctrl">
URL: <input type="url" name="input" ng-model="text" required>
@ -64,16 +56,16 @@ interaction with the input element.</p></li>
</script>
</div>
<div class="tab-pane" title="script.js">
<pre class="prettyprint linenums" ng-set-text="script.js-124"></pre>
<script type="text/ng-template" id="script.js-124">
<pre class="prettyprint linenums" ng-set-text="script.js-41"></pre>
<script type="text/ng-template" id="script.js-41">
function Ctrl($scope) {
$scope.text = 'http://google.com';
}
</script>
</div>
<div class="tab-pane" title="End to end test">
<pre class="prettyprint linenums" ng-set-text="scenario.js-126"></pre>
<script type="text/ng-template" id="scenario.js-126">
<pre class="prettyprint linenums" ng-set-text="scenario.js-43"></pre>
<script type="text/ng-template" id="scenario.js-43">
it('should initialize to model', function() {
expect(binding('text')).toEqual('http://google.com');
expect(binding('myForm.input.$valid')).toEqual('true');
@ -91,6 +83,7 @@ interaction with the input element.</p></li>
});
</script>
</div>
</div><h4>Demo</h4>
<div class="well doc-example-live animator-container" ng-embed-app="" ng-set-html="index.html-125" ng-eval-javascript="script.js-124"></div></div>
</div><h2>Demo</h4>
<div class="well doc-example-live animate-container" ng-embed-app="" ng-set-html="index.html-42" ng-eval-javascript="script.js-41"></div>
</div></div>
</div>

View file

@ -1,131 +0,0 @@
<h1><code ng:non-bindable="">ngAnimate</code>
<span class="hint">(directive in module <code ng:non-bindable="">ng</code>
)</span>
</h1>
<div><a href="http://github.com/angular/angular.js/edit/master/src/ng/animator.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p>The <code>ngAnimate</code> directive works as an attribute that is attached alongside pre-existing directives.
It effects how the directive will perform DOM manipulation. This allows for complex animations to take place while
without burduning the directive which uses the animation with animation details. The built dn directives
<code>ngRepeat</code>, <code>ngInclude</code>, <code>ngSwitch</code>, <code>ngShow</code>, <code>ngHide</code> and <code>ngView</code> already accept <code>ngAnimate</code> directive.
Custom directives can take advantage of animation through <a href="api/ng.$animator"><code>$animator service</code></a>.</p>
<p>Below is a more detailed breakdown of the supported callback events provided by pre-exisitng ng directives:</p>
<ul>
<li><a href="api/ng.directive:ngRepeat#animations"><code>ngRepeat</code></a> — enter, leave and move</li>
<li><a href="api/ng.directive:ngView#animations"><code>ngView</code></a> — enter and leave</li>
<li><a href="api/ng.directive:ngInclude#animations"><code>ngInclude</code></a> — enter and leave</li>
<li><a href="api/ng.directive:ngSwitch#animations"><code>ngSwitch</code></a> — enter and leave</li>
<li><a href="api/ng.directive:ngShow#animations"><code>ngShow &amp; ngHide</code></a> - show and hide respectively</li>
</ul>
<p>You can find out more information about animations upon visiting each directive page.</p>
<p>Below is an example of a directive that makes use of the ngAnimate attribute:</p>
<pre class="prettyprint linenums">
&lt;!-- you can also use data-ng-animate, ng:animate or x-ng-animate as well --&gt;
&lt;ANY ng-directive ng-animate="{event1: 'animation-name', event2: 'animation-name-2'}"&gt;&lt;/ANY&gt;
&lt;!-- you can also use a short hand --&gt;
&lt;ANY ng-directive ng-animate=" 'animation' "&gt;&lt;/ANY&gt;
&lt;!-- which expands to --&gt;
&lt;ANY ng-directive ng-animate="{ enter: 'animation-enter', leave: 'animation-leave', ...}"&gt;&lt;/ANY&gt;
&lt;!-- keep in mind that ng-animate can take expressions --&gt;
&lt;ANY ng-directive ng-animate=" computeCurrentAnimation() "&gt;&lt;/ANY&gt;
</pre>
<p>The <code>event1</code> and <code>event2</code> attributes refer to the animation events specific to the directive that has been assigned.</p>
<h4>CSS-defined Animations</h4>
<p>By default, ngAnimate attaches two CSS3 classes per animation event to the DOM element to achieve the animation.
This is up to you, the developer, to ensure that the animations take place using cross-browser CSS3 transitions.
All that is required is the following CSS code:</p>
<pre class="prettyprint linenums">
&lt;style type="text/css"&gt;
/&#42;
The animate-enter prefix is the event name that you
have provided within the ngAnimate attribute.
&#42;/
.animate-enter-setup {
-webkit-transition: 1s linear all; /&#42; Safari/Chrome &#42;/
-moz-transition: 1s linear all; /&#42; Firefox &#42;/
-ms-transition: 1s linear all; /&#42; IE10 &#42;/
-o-transition: 1s linear all; /&#42; Opera &#42;/
transition: 1s linear all; /&#42; Future Browsers &#42;/
/&#42; The animation preparation code &#42;/
opacity: 0;
}
/&#42;
Keep in mind that you want to combine both CSS
classes together to avoid any CSS-specificity
conflicts
&#42;/
.animate-enter-setup.animate-enter-start {
/&#42; The animation code itself &#42;/
opacity: 1;
}
&lt;/style&gt;
&lt;div ng-directive ng-animate="{enter: 'animate-enter'}"&gt;&lt;/div&gt;
</pre>
<p>Upon DOM mutation, the setup class is added first, then the browser is allowed to reflow the content and then,
the start class is added to trigger the animation. The ngAnimate directive will automatically extract the duration
of the animation to determine when the animation ends. Once the animation is over then both CSS classes will be
removed from the DOM. If a browser does not support CSS transitions then the animation will start and end
immediately resulting in a DOM element that is at it's final state. This final state is when the DOM element
has no CSS animation classes surrounding it.</p>
<h4>JavaScript-defined Animations</h4>
<p>In the event that you do not want to use CSS3 animations or if you wish to offer animations to browsers that do not
yet support them, then you can make use of JavaScript animations defined inside ngModule.</p>
<pre class="prettyprint linenums">
var ngModule = angular.module('YourApp', []);
ngModule.animation('animate-enter', function() {
return {
setup : function(element) {
//prepare the element for animation
element.css({ 'opacity': 0 });
var memo = "..."; //this value is passed to the start function
return memo;
},
start : function(element, done, memo) {
//start the animation
element.animate({
'opacity' : 1
}, function() {
//call when the animation is complete
done()
});
}
}
});
</pre>
<p>As you can see, the JavaScript code follows a similar template to the CSS3 animations. Once defined, the animation
can be used in the same way with the ngAnimate attribute. Keep in mind that, when using JavaScript-enabled
animations, ngAnimate will also add in the same CSS classes that CSS-enabled animations do (even if you're using
JavaScript animations) to animated the element, but it will not attempt to find any CSS3 transition duration value.
It will instead close off the animation once the provided done function is executed. So it's important that you
make sure your animations remember to fire off the done function once the animations are complete.</p></div>
<h2 id="Usage">Usage</h2>
<div class="usage">as attribute<pre class="prettyprint linenums">&lt;ANY ng-animate="{expression}"&gt;
...
&lt;/ANY&gt;</pre>
as class<pre class="prettyprint linenums">&lt;ANY class="ng-animate: {expression};"&gt;
...
&lt;/ANY&gt;</pre>
<h3 id="Parameters">Parameters</h3>
<ul class="parameters"><li><code ng:non-bindable="">ngAnimate {expression} </code>
<p>Used to configure the DOM manipulation animations.</p></li>
</ul>
</div>
</div>

41
lib/angular/docs/partials/api/ng.directive:ngApp.html Normal file → Executable file
View file

@ -1,29 +1,31 @@
<h1><code ng:non-bindable="">ngApp</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/Angular.js#L958" 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/Angular.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">ngApp</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/Angular.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p>Use this directive to auto-bootstrap on application. Only
one directive can be used per HTML document. The directive
<div><h2 id="Description">Description</h2>
<div class="description"><div class="ng-directive-page ng-directive-ngapp-page"><p>Use this directive to auto-bootstrap an application. Only
one ngApp directive can be used per HTML document. The directive
designates the root of the application and is typically placed
at the root of the page.</p>
<p>The first ngApp found in the document will be auto-bootstrapped. To use multiple applications in an
HTML document you must manually bootstrap them using <a href="api/angular.bootstrap"><code>angular.bootstrap</code></a>.
Applications cannot be nested.</p>
<p>In the example below if the <code>ngApp</code> directive would not be placed
on the <code>html</code> element then the document would not be compiled
and the <code>{{ 1+2 }}</code> would not be resolved to <code>3</code>.</p>
<p><code>ngApp</code> is the easiest way to bootstrap an application.</p>
<h4>Source</h4>
<div source-edit="" source-edit-deps="angular.js" source-edit-html="index.html-82" source-edit-css="" source-edit-js="" source-edit-unit="" source-edit-scenario=""></div>
<p> <h4>Source</h2>
<div source-edit="" source-edit-deps="angular.js" source-edit-html="index.html" source-edit-css="" source-edit-js="" source-edit-json="" source-edit-unit="" source-edit-scenario=""></div>
<div class="tabbable"><div class="tab-pane" title="index.html">
<pre class="prettyprint linenums" ng-set-text="index.html-82" ng-html-wrap=" angular.js"></pre>
<script type="text/ng-template" id="index.html-82">
<pre class="prettyprint linenums" ng-set-text="index.html" ng-html-wrap=" angular.js"></pre>
<script type="text/ng-template" id="index.html">
I can add: 1 + 2 = {{ 1+2 }}
</script>
</div>
</div><h4>Demo</h4>
<div class="well doc-example-live animator-container" ng-embed-app="" ng-set-html="index.html-82" ng-eval-javascript=""></div></div>
</div><h2>Demo</h4>
<div class="well doc-example-live animate-container" ng-embed-app="" ng-set-html="index.html" ng-eval-javascript=""></div>
</div></div>
<h2 id="Usage">Usage</h2>
<div class="usage">as attribute<pre class="prettyprint linenums">&lt;ANY ng-app="{angular.Module}"&gt;
...
@ -31,10 +33,7 @@ and the <code>{{ 1+2 }}</code> would not be resolved to <code>3</code>.</p>
as class<pre class="prettyprint linenums">&lt;ANY class="ng-app: {angular.Module};"&gt;
...
&lt;/ANY&gt;</pre>
<h3 id="Parameters">Parameters</h3>
<ul class="parameters"><li><code ng:non-bindable="">ngApp {angular.Module} </code>
<p>an optional application
<a href="api/angular.module"><code>module</code></a> name to load.</p></li>
</ul>
</div>
<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>ngApp</td><td><a href="" class="label type-hint type-hint-angular">angular.Module</a></td><td><div class="ng-directive-page ng-directive-ngapp-page"><p>an optional application
<a href="api/angular.module"><code>module</code></a> name to load.</p>
</div></td></tr></tbody></table></div>
</div>

56
lib/angular/docs/partials/api/ng.directive:ngBind.html Normal file → Executable file
View file

@ -1,22 +1,20 @@
<h1><code ng:non-bindable="">ngBind</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/ngBind.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/ngBind.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">ngBind</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/ngBind.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p>The <code>ngBind</code> attribute tells Angular to replace the text content of the specified HTML element
<div><h2 id="Description">Description</h2>
<div class="description"><div class="ng-directive-page ng-directive-ngbind-page"><p>The <code>ngBind</code> attribute tells Angular to replace the text content of the specified HTML element
with the value of a given expression, and to update the text content when the value of that
expression changes.</p>
<p>Typically, you don't use <code>ngBind</code> directly, but instead you use the double curly markup like
<p>Typically, you don&#39;t use <code>ngBind</code> directly, but instead you use the double curly markup like
<code>{{ expression }}</code> which is similar but less verbose.</p>
<p>Once scenario in which the use of <code>ngBind</code> is preferred over <code>{{ expression }}</code> binding is when
it's desirable to put bindings into template that is momentarily displayed by the browser in its
raw state before Angular compiles it. Since <code>ngBind</code> is an element attribute, it makes the
bindings invisible to the user while the page is loading.</p>
<p>It is preferrable to use <code>ngBind</code> instead of <code>{{ expression }}</code> when a template is momentarily
displayed by the browser in its raw state before Angular compiles it. Since <code>ngBind</code> is an
element attribute, it makes the bindings invisible to the user while the page is loading.</p>
<p>An alternative solution to this problem would be using the
<a href="api/ng.directive:ngCloak"><code>ngCloak</code></a> directive.</p></div>
<a href="api/ng.directive:ngCloak"><code>ngCloak</code></a> directive.</p>
</div></div>
<h2 id="Usage">Usage</h2>
<div class="usage">as attribute<pre class="prettyprint linenums">&lt;ANY ng-bind="{expression}"&gt;
...
@ -24,18 +22,15 @@ bindings invisible to the user while the page is loading.</p>
as class<pre class="prettyprint linenums">&lt;ANY class="ng-bind: {expression};"&gt;
...
&lt;/ANY&gt;</pre>
<h3 id="Parameters">Parameters</h3>
<ul class="parameters"><li><code ng:non-bindable="">ngBind {expression} </code>
<p><a href="guide/expression">Expression</a> to evaluate.</p></li>
</ul>
</div>
<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>ngBind</td><td><a href="" class="label type-hint type-hint-expression">expression</a></td><td><div class="ng-directive-page ng-directive-ngbind-page"><p><a href="guide/expression">Expression</a> to evaluate.</p>
</div></td></tr></tbody></table></div>
<h2 id="Example">Example</h2>
<div class="example"><p>Enter a name in the Live Preview text box; the greeting below the text box changes instantly.
<h4>Source</h4>
<div source-edit="" source-edit-deps="angular.js script.js" source-edit-html="index.html-104" source-edit-css="" source-edit-js="script.js-103" source-edit-unit="" source-edit-scenario="scenario.js-105"></div>
<div class="example"><div class="ng-directive-page ng-directive-ngbind-page"><p>Enter a name in the Live Preview text box; the greeting below the text box changes instantly.
<h4>Source</h2>
<div source-edit="" source-edit-deps="angular.js script.js" source-edit-html="index.html-17" source-edit-css="" source-edit-js="script.js-16" source-edit-json="" source-edit-unit="" source-edit-scenario="scenario.js-18"></div>
<div class="tabbable"><div class="tab-pane" title="index.html">
<pre class="prettyprint linenums" ng-set-text="index.html-104" ng-html-wrap=" angular.js script.js"></pre>
<script type="text/ng-template" id="index.html-104">
<pre class="prettyprint linenums" ng-set-text="index.html-17" ng-html-wrap=" angular.js script.js"></pre>
<script type="text/ng-template" id="index.html-17">
<div ng-controller="Ctrl">
Enter name: <input type="text" ng-model="name"><br>
@ -44,16 +39,16 @@ as class<pre class="prettyprint linenums">&lt;ANY class="ng-bind: {expression};"
</script>
</div>
<div class="tab-pane" title="script.js">
<pre class="prettyprint linenums" ng-set-text="script.js-103"></pre>
<script type="text/ng-template" id="script.js-103">
<pre class="prettyprint linenums" ng-set-text="script.js-16"></pre>
<script type="text/ng-template" id="script.js-16">
function Ctrl($scope) {
$scope.name = 'Whirled';
}
</script>
</div>
<div class="tab-pane" title="End to end test">
<pre class="prettyprint linenums" ng-set-text="scenario.js-105"></pre>
<script type="text/ng-template" id="scenario.js-105">
<pre class="prettyprint linenums" ng-set-text="scenario.js-18"></pre>
<script type="text/ng-template" id="scenario.js-18">
it('should check ng-bind', function() {
expect(using('.doc-example-live').binding('name')).toBe('Whirled');
using('.doc-example-live').input('name').enter('world');
@ -61,6 +56,7 @@ as class<pre class="prettyprint linenums">&lt;ANY class="ng-bind: {expression};"
});
</script>
</div>
</div><h4>Demo</h4>
<div class="well doc-example-live animator-container" ng-embed-app="" ng-set-html="index.html-104" ng-eval-javascript="script.js-103"></div></div>
</div><h2>Demo</h4>
<div class="well doc-example-live animate-container" ng-embed-app="" ng-set-html="index.html-17" ng-eval-javascript="script.js-16"></div>
</div></div>
</div>

View file

@ -0,0 +1,25 @@
<a href="http://github.com/angular/angular.js/tree/v1.2.0rc1/src/ng/directive/ngBind.js#L117" 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/ngBind.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">ngBindHtml</code>
<div><span class="hint">directive in module <code ng:non-bindable="">ng</code>
</span>
</div>
</h1>
<div><h2 id="Description">Description</h2>
<div class="description"><div class="ng-directive-page ng-directive-ngbindhtml-page"><p>Creates a binding that will innerHTML the result of evaluating the <code>expression</code> into the current
element in a secure way. By default, the innerHTML-ed content will be sanitized using the <a href="api/ngSanitize.$sanitize">$sanitize</a> service. To utilize this functionality, ensure that <code>$sanitize</code>
is available, for example, by including <a href="api/ngSanitize">ngSanitize</a> in your module&#39;s dependencies (not in
core Angular.) You may also bypass sanitization for values you know are safe. To do so, bind to
an explicitly trusted value via <a href="api/ng.$sce#trustAsHtml"><code>$sce.trustAsHtml</code></a>. See the example
under <a href="api/ng.$sce#Example"><code>Strict Contextual Escaping (SCE)</code></a>.</p>
<p>Note: If a <code>$sanitize</code> service is unavailable and the bound value isn&#39;t explicitly trusted, you
will have an exception (instead of an exploit.)</p>
</div></div>
<h2 id="Usage">Usage</h2>
<div class="usage">as attribute<pre class="prettyprint linenums">&lt;ANY ng-bind-html="{expression}"&gt;
...
&lt;/ANY&gt;</pre>
as class<pre class="prettyprint linenums">&lt;ANY class="ng-bind-html: {expression};"&gt;
...
&lt;/ANY&gt;</pre>
<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>ngBindHtml</td><td><a href="" class="label type-hint type-hint-expression">expression</a></td><td><div class="ng-directive-page ng-directive-ngbindhtml-page"><p><a href="guide/expression">Expression</a> to evaluate.</p>
</div></td></tr></tbody></table></div>
</div>

View file

@ -1,24 +0,0 @@
<h1><code ng:non-bindable="">ngBindHtmlUnsafe</code>
<span class="hint">(directive in module <code ng:non-bindable="">ng</code>
)</span>
</h1>
<div><a href="http://github.com/angular/angular.js/edit/master/src/ng/directive/ngBind.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p>Creates a binding that will innerHTML the result of evaluating the <code>expression</code> into the current
element. <em>The innerHTML-ed content will not be sanitized!</em> You should use this directive only if
<a href="api/ngSanitize.directive:ngBindHtml">ngBindHtml</a> directive is too
restrictive and when you absolutely trust the source of the content you are binding to.</p>
<p>See <a href="api/ngSanitize.$sanitize">$sanitize</a> docs for examples.</p></div>
<h2 id="Usage">Usage</h2>
<div class="usage">as attribute<pre class="prettyprint linenums">&lt;ANY ng-bind-html-unsafe="{expression}"&gt;
...
&lt;/ANY&gt;</pre>
as class<pre class="prettyprint linenums">&lt;ANY class="ng-bind-html-unsafe: {expression};"&gt;
...
&lt;/ANY&gt;</pre>
<h3 id="Parameters">Parameters</h3>
<ul class="parameters"><li><code ng:non-bindable="">ngBindHtmlUnsafe {expression} </code>
<p><a href="guide/expression">Expression</a> to evaluate.</p></li>
</ul>
</div>
</div>

View file

@ -1,13 +1,16 @@
<h1><code ng:non-bindable="">ngBindTemplate</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/ngBind.js#L57" 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/ngBind.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">ngBindTemplate</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/ngBind.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p>The <code>ngBindTemplate</code> directive specifies that the element
text should be replaced with the template in ngBindTemplate.
Unlike ngBind the ngBindTemplate can contain multiple <code>{{</code> <code>}}</code>
expressions. (This is required since some HTML elements
can not have SPAN elements such as TITLE, or OPTION to name a few.)</p></div>
<div><h2 id="Description">Description</h2>
<div class="description"><div class="ng-directive-page ng-directive-ngbindtemplate-page"><p>The <code>ngBindTemplate</code> directive specifies that the element
text content should be replaced with the interpolation of the template
in the <code>ngBindTemplate</code> attribute.
Unlike <code>ngBind</code>, the <code>ngBindTemplate</code> can contain multiple <code>{{</code> <code>}}</code>
expressions. This directive is needed since some HTML elements
(such as TITLE and OPTION) cannot contain SPAN elements.</p>
</div></div>
<h2 id="Usage">Usage</h2>
<div class="usage">as attribute<pre class="prettyprint linenums">&lt;ANY ng-bind-template="{string}"&gt;
...
@ -15,19 +18,16 @@ can not have SPAN elements such as TITLE, or OPTION to name a few.)</p></div>
as class<pre class="prettyprint linenums">&lt;ANY class="ng-bind-template: {string};"&gt;
...
&lt;/ANY&gt;</pre>
<h3 id="Parameters">Parameters</h3>
<ul class="parameters"><li><code ng:non-bindable="">ngBindTemplate {string} </code>
<p>template of form
<tt>{{</tt> <tt>expression</tt> <tt>}}</tt> to eval.</p></li>
</ul>
</div>
<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>ngBindTemplate</td><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="ng-directive-page ng-directive-ngbindtemplate-page"><p>template of form</p>
<p><tt>{{</tt> <tt>expression</tt> <tt>}}</tt> to eval.</p>
</div></td></tr></tbody></table></div>
<h2 id="Example">Example</h2>
<div class="example"><p>Try it here: enter text in text box and watch the greeting change.
<h4>Source</h4>
<div source-edit="" source-edit-deps="angular.js script.js" source-edit-html="index.html-107" source-edit-css="" source-edit-js="script.js-106" source-edit-unit="" source-edit-scenario="scenario.js-108"></div>
<div class="example"><div class="ng-directive-page ng-directive-ngbindtemplate-page"><p>Try it here: enter text in text box and watch the greeting change.
<h4>Source</h2>
<div source-edit="" source-edit-deps="angular.js script.js" source-edit-html="index.html-20" source-edit-css="" source-edit-js="script.js-19" source-edit-json="" source-edit-unit="" source-edit-scenario="scenario.js-21"></div>
<div class="tabbable"><div class="tab-pane" title="index.html">
<pre class="prettyprint linenums" ng-set-text="index.html-107" ng-html-wrap=" angular.js script.js"></pre>
<script type="text/ng-template" id="index.html-107">
<pre class="prettyprint linenums" ng-set-text="index.html-20" ng-html-wrap=" angular.js script.js"></pre>
<script type="text/ng-template" id="index.html-20">
<div ng-controller="Ctrl">
Salutation: <input type="text" ng-model="salutation"><br>
@ -37,8 +37,8 @@ as class<pre class="prettyprint linenums">&lt;ANY class="ng-bind-template: {stri
</script>
</div>
<div class="tab-pane" title="script.js">
<pre class="prettyprint linenums" ng-set-text="script.js-106"></pre>
<script type="text/ng-template" id="script.js-106">
<pre class="prettyprint linenums" ng-set-text="script.js-19"></pre>
<script type="text/ng-template" id="script.js-19">
function Ctrl($scope) {
$scope.salutation = 'Hello';
$scope.name = 'World';
@ -46,8 +46,8 @@ as class<pre class="prettyprint linenums">&lt;ANY class="ng-bind-template: {stri
</script>
</div>
<div class="tab-pane" title="End to end test">
<pre class="prettyprint linenums" ng-set-text="scenario.js-108"></pre>
<script type="text/ng-template" id="scenario.js-108">
<pre class="prettyprint linenums" ng-set-text="scenario.js-21"></pre>
<script type="text/ng-template" id="scenario.js-21">
it('should check ng-bind', function() {
expect(using('.doc-example-live').binding('salutation')).
toBe('Hello');
@ -62,6 +62,7 @@ as class<pre class="prettyprint linenums">&lt;ANY class="ng-bind-template: {stri
});
</script>
</div>
</div><h4>Demo</h4>
<div class="well doc-example-live animator-container" ng-embed-app="" ng-set-html="index.html-107" ng-eval-javascript="script.js-106"></div></div>
</div><h2>Demo</h4>
<div class="well doc-example-live animate-container" ng-embed-app="" ng-set-html="index.html-20" ng-eval-javascript="script.js-19"></div>
</div></div>
</div>

View file

@ -0,0 +1,22 @@
<a href="http://github.com/angular/angular.js/tree/v1.2.0rc1/src/ng/directive/ngEventDirs.js#L283" 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/ngEventDirs.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">ngBlur</code>
<div><span class="hint">directive in module <code ng:non-bindable="">ng</code>
</span>
</div>
</h1>
<div><h2 id="Description">Description</h2>
<div class="description"><div class="ng-directive-page ng-directive-ngblur-page"><p>Specify custom behavior on blur event.</p>
</div></div>
<h2 id="Usage">Usage</h2>
<div class="usage">as attribute<pre class="prettyprint linenums">&lt;window, input, select, textarea, a ng-blur="{expression}"&gt;
...
&lt;/window, input, select, textarea, a&gt;</pre>
as class<pre class="prettyprint linenums">&lt;window, input, select, textarea, a class="ng-blur: {expression};"&gt;
...
&lt;/window, input, select, textarea, a&gt;</pre>
<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>ngBlur</td><td><a href="" class="label type-hint type-hint-expression">expression</a></td><td><div class="ng-directive-page ng-directive-ngblur-page"><p><a href="guide/expression">Expression</a> to evaluate upon
blur. (Event object is available as <code>$event</code>)</p>
</div></td></tr></tbody></table></div>
<h2 id="Example">Example</h2>
<div class="example"><div class="ng-directive-page ng-directive-ngblur-page"><p>See <a href="api/ng.directive:ngClick"><code>ngClick</code></a></p>
</div></div>
</div>

View file

@ -1,22 +1,23 @@
<h1><code ng:non-bindable="">ngChange</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/input.js#L1165" 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/input.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">ngChange</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/input.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p>Evaluate given expression when user changes the input.
<div><h2 id="Description">Description</h2>
<div class="description"><div class="ng-directive-page ng-directive-ngchange-page"><p>Evaluate given expression when user changes the input.
The expression is not evaluated when the value change is coming from the model.</p>
<p>Note, this directive requires <code>ngModel</code> to be present.</p></div>
<p>Note, this directive requires <code>ngModel</code> to be present.</p>
</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">&lt;ng-change&gt;
<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">&lt;ng-change&gt;
&lt;/ng-change&gt;</pre>
</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-144" source-edit-css="" source-edit-js="script.js-143" source-edit-unit="" source-edit-scenario="scenario.js-145"></div>
<div class="example"><div class="ng-directive-page ng-directive-ngchange-page"><h4>Source</h2>
<div source-edit="" source-edit-deps="angular.js script.js" source-edit-html="index.html-61" source-edit-css="" source-edit-js="script.js-60" source-edit-json="" source-edit-unit="" source-edit-scenario="scenario.js-62"></div>
<div class="tabbable"><div class="tab-pane" title="index.html">
<pre class="prettyprint linenums" ng-set-text="index.html-144" ng-html-wrap=" angular.js script.js"></pre>
<script type="text/ng-template" id="index.html-144">
<pre class="prettyprint linenums" ng-set-text="index.html-61" ng-html-wrap=" angular.js script.js"></pre>
<script type="text/ng-template" id="index.html-61">
<div ng-controller="Controller">
<input type="checkbox" ng-model="confirmed" ng-change="change()" id="ng-change-example1" />
@ -28,8 +29,8 @@ The expression is not evaluated when the value change is coming from the model.<
</script>
</div>
<div class="tab-pane" title="script.js">
<pre class="prettyprint linenums" ng-set-text="script.js-143"></pre>
<script type="text/ng-template" id="script.js-143">
<pre class="prettyprint linenums" ng-set-text="script.js-60"></pre>
<script type="text/ng-template" id="script.js-60">
function Controller($scope) {
$scope.counter = 0;
$scope.change = function() {
@ -39,8 +40,8 @@ The expression is not evaluated when the value change is coming from the model.<
</script>
</div>
<div class="tab-pane" title="End to end test">
<pre class="prettyprint linenums" ng-set-text="scenario.js-145"></pre>
<script type="text/ng-template" id="scenario.js-145">
<pre class="prettyprint linenums" ng-set-text="scenario.js-62"></pre>
<script type="text/ng-template" id="scenario.js-62">
it('should evaluate the expression if changing from view', function() {
expect(binding('counter')).toEqual('0');
element('#ng-change-example1').click();
@ -55,6 +56,7 @@ The expression is not evaluated when the value change is coming from the model.<
});
</script>
</div>
</div><h4>Demo</h4>
<div class="well doc-example-live animator-container" ng-embed-app="" ng-set-html="index.html-144" ng-eval-javascript="script.js-143"></div></div>
</div><h2>Demo</h4>
<div class="well doc-example-live animate-container" ng-embed-app="" ng-set-html="index.html-61" ng-eval-javascript="script.js-60"></div>
</div></div>
</div>

View file

@ -1,34 +1,33 @@
<h1><code ng:non-bindable="">ngChecked</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/booleanAttrs.js#L172" 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/booleanAttrs.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">ngChecked</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/booleanAttrs.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p>The HTML specs do not require browsers to preserve the special attributes such as checked.
<div><h2 id="Description">Description</h2>
<div class="description"><div class="ng-directive-page ng-directive-ngchecked-page"><p>The HTML specs do not require browsers to preserve the special attributes such as checked.
(The presence of them means true and absence means false)
This prevents the angular compiler from correctly retrieving the binding expression.
To solve this problem, we introduce the <code>ngChecked</code> directive.</p></div>
To solve this problem, we introduce the <code>ngChecked</code> directive.</p>
</div></div>
<h2 id="Usage">Usage</h2>
<div class="usage">as attribute<pre class="prettyprint linenums">&lt;INPUT ng-checked="{expression}"&gt;
...
&lt;/INPUT&gt;</pre>
<h3 id="Parameters">Parameters</h3>
<ul class="parameters"><li><code ng:non-bindable="">ngChecked {expression} </code>
<p>Angular expression that will be evaluated.</p></li>
</ul>
</div>
<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>ngChecked</td><td><a href="" class="label type-hint type-hint-expression">expression</a></td><td><div class="ng-directive-page ng-directive-ngchecked-page"><p>Angular expression that will be evaluated.</p>
</div></td></tr></tbody></table></div>
<h2 id="Example">Example</h2>
<div class="example"><h4>Source</h4>
<div source-edit="" source-edit-deps="angular.js" source-edit-html="index.html-90" source-edit-css="" source-edit-js="" source-edit-unit="" source-edit-scenario="scenario.js-91"></div>
<div class="example"><div class="ng-directive-page ng-directive-ngchecked-page"><h4>Source</h2>
<div source-edit="" source-edit-deps="angular.js" source-edit-html="index.html-5" source-edit-css="" source-edit-js="" source-edit-json="" source-edit-unit="" source-edit-scenario="scenario.js-6"></div>
<div class="tabbable"><div class="tab-pane" title="index.html">
<pre class="prettyprint linenums" ng-set-text="index.html-90" ng-html-wrap=" angular.js"></pre>
<script type="text/ng-template" id="index.html-90">
<pre class="prettyprint linenums" ng-set-text="index.html-5" ng-html-wrap=" angular.js"></pre>
<script type="text/ng-template" id="index.html-5">
Check me to check both: <input type="checkbox" ng-model="master"><br/>
<input id="checkSlave" type="checkbox" ng-checked="master">
</script>
</div>
<div class="tab-pane" title="End to end test">
<pre class="prettyprint linenums" ng-set-text="scenario.js-91"></pre>
<script type="text/ng-template" id="scenario.js-91">
<pre class="prettyprint linenums" ng-set-text="scenario.js-6"></pre>
<script type="text/ng-template" id="scenario.js-6">
it('should check both checkBoxes', function() {
expect(element('.doc-example-live #checkSlave').prop('checked')).toBeFalsy();
input('master').check();
@ -36,6 +35,7 @@ To solve this problem, we introduce the <code>ngChecked</code> directive.</p></d
});
</script>
</div>
</div><h4>Demo</h4>
<div class="well doc-example-live animator-container" ng-embed-app="" ng-set-html="index.html-90" ng-eval-javascript=""></div></div>
</div><h2>Demo</h4>
<div class="well doc-example-live animate-container" ng-embed-app="" ng-set-html="index.html-5" ng-eval-javascript=""></div>
</div></div>
</div>

176
lib/angular/docs/partials/api/ng.directive:ngClass.html Normal file → Executable file
View file

@ -1,15 +1,15 @@
<h1><code ng:non-bindable="">ngClass</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/ngClass.js#L72" 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/ngClass.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">ngClass</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/ngClass.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p>The <code>ngClass</code> allows you to set CSS class on HTML element dynamically by databinding an
expression that represents all classes to be added.</p>
<p>The directive won't add duplicate classes if a particular class was already set.</p>
<div><h2 id="Description">Description</h2>
<div class="description"><div class="ng-directive-page ng-directive-ngclass-page"><p>The <code>ngClass</code> allows you to set CSS classes on HTML an element, dynamically, by databinding
an expression that represents all classes to be added.</p>
<p>The directive won&#39;t add duplicate classes if a particular class was already set.</p>
<p>When the expression changes, the previously added classes are removed and only then the
new classes are added.</p></div>
new classes are added.</p>
</div></div>
<h2 id="Usage">Usage</h2>
<div class="usage">as attribute<pre class="prettyprint linenums">&lt;ANY ng-class="{expression}"&gt;
...
@ -17,52 +17,136 @@ new classes are added.</p></div>
as class<pre class="prettyprint linenums">&lt;ANY class="ng-class: {expression};"&gt;
...
&lt;/ANY&gt;</pre>
<h3 id="Parameters">Parameters</h3>
<ul class="parameters"><li><code ng:non-bindable="">ngClass {expression} </code>
<p><a href="guide/expression">Expression</a> to eval. The result
<h3 id="Animations">Animations</h3>
<div class="animations"><ul><li>add - happens just before the class is applied to the element</li><li>remove - happens just before the class is removed from the element</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>ngClass</td><td><a href="" class="label type-hint type-hint-expression">expression</a></td><td><div class="ng-directive-page ng-directive-ngclass-page"><p><a href="guide/expression">Expression</a> to eval. The result
of the evaluation can be a string representing space delimited class
names, an array, or a map of class names to boolean values.</p></li>
</ul>
</div>
names, an array, or a map of class names to boolean values. In the case of a map, the
names of the properties whose values are truthy will be added as css classes to the
element.</p>
</div></td></tr></tbody></table></div>
<h2 id="Example">Example</h2>
<div class="example"><h4>Source</h4>
<div source-edit="" source-edit-deps="angular.js" source-edit-html="index.html-109" source-edit-css="style.css-110" source-edit-js="" source-edit-unit="" source-edit-scenario="scenario.js-111"></div>
<div class="example"><div class="ng-directive-page ng-directive-ngclass-page"><p>Example that demostrates basic bindings via ngClass directive.
<h4>Source</h2>
<div source-edit="" source-edit-deps="angular.js" source-edit-html="index.html-22" source-edit-css="style.css" source-edit-js="" source-edit-json="" source-edit-unit="" source-edit-scenario="scenario.js-23"></div>
<div class="tabbable"><div class="tab-pane" title="index.html">
<pre class="prettyprint linenums" ng-set-text="index.html-109" ng-html-wrap=" angular.js"></pre>
<script type="text/ng-template" id="index.html-109">
<input type="button" value="set" ng-click="myVar='my-class'">
<input type="button" value="clear" ng-click="myVar=''">
<br>
<span ng-class="myVar">Sample Text</span>
</script>
<pre class="prettyprint linenums" ng-set-text="index.html-22" ng-html-wrap=" angular.js"></pre>
<script type="text/ng-template" id="index.html-22">
<p ng-class="{strike: strike, bold: bold, red: red}">Map Syntax Example</p>
<input type="checkbox" ng-model="bold"> bold
<input type="checkbox" ng-model="strike"> strike
<input type="checkbox" ng-model="red"> red
<hr>
<p ng-class="style">Using String Syntax</p>
<input type="text" ng-model="style" placeholder="Type: bold strike red">
<hr>
<p ng-class="[style1, style2, style3]">Using Array Syntax</p>
<input ng-model="style1" placeholder="Type: bold"><br>
<input ng-model="style2" placeholder="Type: strike"><br>
<input ng-model="style3" placeholder="Type: red"><br>
</script>
</div>
<div class="tab-pane" title="style.css">
<pre class="prettyprint linenums" ng-set-text="style.css-110"></pre>
<style type="text/css" id="style.css-110">
.my-class {
color: red;
}
</style>
<pre class="prettyprint linenums" ng-set-text="style.css"></pre>
<style type="text/css" id="style.css">
.strike {
text-decoration: line-through;
}
.bold {
font-weight: bold;
}
.red {
color: red;
}
</style>
</div>
<div class="tab-pane" title="End to end test">
<pre class="prettyprint linenums" ng-set-text="scenario.js-111"></pre>
<script type="text/ng-template" id="scenario.js-111">
it('should check ng-class', function() {
expect(element('.doc-example-live span').prop('className')).not().
toMatch(/my-class/);
<pre class="prettyprint linenums" ng-set-text="scenario.js-23"></pre>
<script type="text/ng-template" id="scenario.js-23">
it('should let you toggle the class', function() {
using('.doc-example-live').element(':button:first').click();
expect(element('.doc-example-live p:first').prop('className')).not().toMatch(/bold/);
expect(element('.doc-example-live p:first').prop('className')).not().toMatch(/red/);
expect(element('.doc-example-live span').prop('className')).
toMatch(/my-class/);
input('bold').check();
expect(element('.doc-example-live p:first').prop('className')).toMatch(/bold/);
using('.doc-example-live').element(':button:last').click();
input('red').check();
expect(element('.doc-example-live p:first').prop('className')).toMatch(/red/);
});
expect(element('.doc-example-live span').prop('className')).not().
toMatch(/my-class/);
});
</script>
it('should let you toggle string example', function() {
expect(element('.doc-example-live p:nth-of-type(2)').prop('className')).toBe('');
input('style').enter('red');
expect(element('.doc-example-live p:nth-of-type(2)').prop('className')).toBe('red');
});
it('array example should have 3 classes', function() {
expect(element('.doc-example-live p:last').prop('className')).toBe('');
input('style1').enter('bold');
input('style2').enter('strike');
input('style3').enter('red');
expect(element('.doc-example-live p:last').prop('className')).toBe('bold strike red');
});
</script>
</div>
</div><h4>Demo</h4>
<div class="well doc-example-live animator-container" ng-embed-app="" ng-set-html="index.html-109" ng-eval-javascript=""></div></div>
</div><h2>Demo</h2>
<div class="well doc-example-live animate-container" ng-embed-app="" ng-set-html="index.html-22" ng-eval-javascript=""></div>
<h2>Animations</h2>
<p>Example that demostrates how addition and removal of classes can be animated.</p>
<h2>Source</h2>
<div source-edit="" source-edit-deps="angular.js angular-animate.js" source-edit-html="index.html-24" source-edit-css="style.css-25" source-edit-js="" source-edit-json="" source-edit-unit="" source-edit-scenario="scenario.js-26"></div>
<div class="tabbable"><div class="tab-pane" title="index.html">
<pre class="prettyprint linenums" ng-set-text="index.html-24" ng-html-wrap=" angular.js angular-animate.js"></pre>
<script type="text/ng-template" id="index.html-24">
<input type="button" value="set" ng-click="myVar='my-class'">
<input type="button" value="clear" ng-click="myVar=''">
<br>
<span ng-class="myVar">Sample Text</span>
</script>
</div>
<div class="tab-pane" title="style.css">
<pre class="prettyprint linenums" ng-set-text="style.css-25"></pre>
<style type="text/css" id="style.css-25">
.my-class-add, .my-class-remove {
-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;
-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;
}
.my-class,
.my-class-add.my-class-add-active {
color: red;
font-size:3em;
}
.my-class-remove.my-class-remove-active {
font-size:1.0em;
color:black;
}
</style>
</div>
<div class="tab-pane" title="End to end test">
<pre class="prettyprint linenums" ng-set-text="scenario.js-26"></pre>
<script type="text/ng-template" id="scenario.js-26">
it('should check ng-class', function() {
expect(element('.doc-example-live span').prop('className')).not().
toMatch(/my-class/);
using('.doc-example-live').element(':button:first').click();
expect(element('.doc-example-live span').prop('className')).
toMatch(/my-class/);
using('.doc-example-live').element(':button:last').click();
expect(element('.doc-example-live span').prop('className')).not().
toMatch(/my-class/);
});
</script>
</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-24" ng-eval-javascript=""></div>
</div></div>
</div>

View file

@ -1,14 +1,15 @@
<h1><code ng:non-bindable="">ngClassEven</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/ngClass.js#L249" 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/ngClass.js" class="improve-docs btn btn-primary"><i class="icon-edit"> </i> Improve this doc</a><h1><code ng:non-bindable="">ngClassEven</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/ngClass.js" class="improve-docs btn btn-primary">Improve this doc</a><h2 id="Description">Description</h2>
<div class="description"><p>The <code>ngClassOdd</code> and <code>ngClassEven</code> works exactly as
<div><h2 id="Description">Description</h2>
<div class="description"><div class="ng-directive-page ng-directive-ngclasseven-page"><p>The <code>ngClassOdd</code> and <code>ngClassEven</code> directives work exactly as
<a href="api/ng.directive:ngClass"><code>ngClass</code></a>, except it works in
conjunction with <code>ngRepeat</code> and takes affect only on odd (even) rows.</p>
<p>This directive can be applied only within a scope of an
<a href="api/ng.directive:ngRepeat"><code>ngRepeat</code></a>.</p></div>
<a href="api/ng.directive:ngRepeat"><code>ngRepeat</code></a>.</p>
</div></div>
<h2 id="Usage">Usage</h2>
<div class="usage">as attribute<pre class="prettyprint linenums">&lt;ANY ng-class-even="{expression}"&gt;
...
@ -16,18 +17,15 @@ conjunction with <code>ngRepeat</code> and takes affect only on odd (even) rows.
as class<pre class="prettyprint linenums">&lt;ANY class="ng-class-even: {expression};"&gt;
...
&lt;/ANY&gt;</pre>
<h3 id="Parameters">Parameters</h3>
<ul class="parameters"><li><code ng:non-bindable="">ngClassEven {expression} </code>
<p><a href="guide/expression">Expression</a> to eval. The
result of the evaluation can be a string representing space delimited class names or an array.</p></li>
</ul>
</div>
<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>ngClassEven</td><td><a href="" class="label type-hint type-hint-expression">expression</a></td><td><div class="ng-directive-page ng-directive-ngclasseven-page"><p><a href="guide/expression">Expression</a> to eval. The
result of the evaluation can be a string representing space delimited class names or an array.</p>
</div></td></tr></tbody></table></div>
<h2 id="Example">Example</h2>
<div class="example"><h4>Source</h4>
<div source-edit="" source-edit-deps="angular.js" source-edit-html="index.html-115" source-edit-css="style.css-116" source-edit-js="" source-edit-unit="" source-edit-scenario="scenario.js-117"></div>
<div class="example"><div class="ng-directive-page ng-directive-ngclasseven-page"><h4>Source</h2>
<div source-edit="" source-edit-deps="angular.js" source-edit-html="index.html-30" source-edit-css="style.css-31" source-edit-js="" source-edit-json="" source-edit-unit="" source-edit-scenario="scenario.js-32"></div>
<div class="tabbable"><div class="tab-pane" title="index.html">
<pre class="prettyprint linenums" ng-set-text="index.html-115" ng-html-wrap=" angular.js"></pre>
<script type="text/ng-template" id="index.html-115">
<pre class="prettyprint linenums" ng-set-text="index.html-30" ng-html-wrap=" angular.js"></pre>
<script type="text/ng-template" id="index.html-30">
<ol ng-init="names=['John', 'Mary', 'Cate', 'Suz']">
<li ng-repeat="name in names">
<span ng-class-odd="'odd'" ng-class-even="'even'">
@ -38,8 +36,8 @@ result of the evaluation can be a string representing space delimited class name
</script>
</div>
<div class="tab-pane" title="style.css">
<pre class="prettyprint linenums" ng-set-text="style.css-116"></pre>
<style type="text/css" id="style.css-116">
<pre class="prettyprint linenums" ng-set-text="style.css-31"></pre>
<style type="text/css" id="style.css-31">
.odd {
color: red;
}
@ -49,8 +47,8 @@ result of the evaluation can be a string representing space delimited class name
</style>
</div>
<div class="tab-pane" title="End to end test">
<pre class="prettyprint linenums" ng-set-text="scenario.js-117"></pre>
<script type="text/ng-template" id="scenario.js-117">
<pre class="prettyprint linenums" ng-set-text="scenario.js-32"></pre>
<script type="text/ng-template" id="scenario.js-32">
it('should check ng-class-odd and ng-class-even', function() {
expect(element('.doc-example-live li:first span').prop('className')).
toMatch(/odd/);
@ -59,6 +57,7 @@ result of the evaluation can be a string representing space delimited class name
});
</script>
</div>
</div><h4>Demo</h4>
<div class="well doc-example-live animator-container" ng-embed-app="" ng-set-html="index.html-115" ng-eval-javascript=""></div></div>
</div><h2>Demo</h4>
<div class="well doc-example-live animate-container" ng-embed-app="" ng-set-html="index.html-30" ng-eval-javascript=""></div>
</div></div>
</div>

Some files were not shown because too many files have changed in this diff Show more