mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-16 23:30:23 +00:00
style(docs): make jslint happy - fix some warnings
This commit is contained in:
parent
035c751076
commit
acbd7cdf32
103 changed files with 569 additions and 573 deletions
|
|
@ -1,5 +0,0 @@
|
|||
@ngdoc overview
|
||||
@name angular.module.NG
|
||||
@description
|
||||
|
||||
The `NG` is an angular module which contains all of the core angular services.
|
||||
|
|
@ -25,7 +25,7 @@ function MyModule($provide, $locationProvider){
|
|||
};
|
||||
</pre>
|
||||
|
||||
See: {@link angular.module.AUTO.$provide $provide}, {@link angular.module.NG.$locationProvider $locationProvider}.
|
||||
See: {@link angular.module.AUTO.$provide $provide}, {@link angular.module.ng.$locationProvider $locationProvider}.
|
||||
|
||||
# Registering Module Function
|
||||
|
||||
|
|
@ -44,11 +44,11 @@ angular.module.MyModule = function(){
|
|||
Then you can refer to your module like this:
|
||||
|
||||
<pre>
|
||||
var injector = angular.injector('NG', 'MyModule')
|
||||
var injector = angular.injector('ng', 'MyModule')
|
||||
</pre>
|
||||
|
||||
Or
|
||||
|
||||
<pre>
|
||||
var injector = angular.injector('NG', angular.module.MyModule)
|
||||
var injector = angular.injector('ng', angular.module.MyModule)
|
||||
</pre>
|
||||
|
|
|
|||
|
|
@ -7,23 +7,23 @@
|
|||
* {@link angular.widget Widgets} - Angular custom DOM element
|
||||
* {@link angular.directive Directives} - Angular DOM element attributes
|
||||
* {@link angular.markup Markup} and {@link angular.attrMarkup Attribute Markup}
|
||||
* {@link angular.module.NG.$filter Filters} - Angular output filters
|
||||
* {@link angular.module.NG.$compile $compile} - Template compiler
|
||||
* {@link angular.module.ng.$filter Filters} - Angular output filters
|
||||
* {@link angular.module.ng.$compile $compile} - Template compiler
|
||||
|
||||
## Angular Scope API
|
||||
|
||||
* {@link angular.module.NG.$rootScope.Scope Scope Object} - Angular scope object
|
||||
* {@link angular.module.ng.$rootScope.Scope Scope Object} - Angular scope object
|
||||
|
||||
|
||||
## Angular Services & Dependency Injection API
|
||||
|
||||
* {@link angular.module.NG Angular Services}
|
||||
* {@link angular.module.ng Angular Services}
|
||||
* {@link angular.injector angular.injector() }
|
||||
|
||||
|
||||
## Angular Testing API
|
||||
|
||||
* {@link angular.module.NG_MOCK Testing Mocks API} - Mock objects for testing
|
||||
* {@link angular.module.ngMock Testing Mocks API} - Mock objects for testing
|
||||
* {@link guide/dev_guide.e2e-testing Angular Scenario Runner} - Automated scenario testing
|
||||
documentation
|
||||
|
||||
|
|
|
|||
|
|
@ -105,9 +105,9 @@ The two partials are defined in the following URLs:
|
|||
# Things to notice
|
||||
|
||||
* Routes are defined in the `AppCntl` class. The initialization of the controller causes the
|
||||
initialization of the {@link api/angular.module.NG.$route $route} service with the proper URL
|
||||
initialization of the {@link api/angular.module.ng.$route $route} service with the proper URL
|
||||
routes.
|
||||
* The {@link api/angular.module.NG.$route $route} service then watches the URL and instantiates the
|
||||
* The {@link api/angular.module.ng.$route $route} service then watches the URL and instantiates the
|
||||
appropriate controller when the URL changes.
|
||||
* The {@link api/angular.widget.ng:view ng:view} widget loads the view when the URL changes. It
|
||||
also
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ allow a user to enter data.
|
|||
|
||||
* The user data model is initialized {@link api/angular.directive.ng:controller controller} and is
|
||||
available in
|
||||
the {@link api/angular.module.NG.$rootScope.Scope scope} with the initial data.
|
||||
the {@link api/angular.module.ng.$rootScope.Scope scope} with the initial data.
|
||||
* For debugging purposes we have included a debug view of the model to better understand what
|
||||
is going on.
|
||||
* The {@link api/angular.widget.input input widgets} simply refer to the model and are data-bound.
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ Take a look through the source and note:
|
|||
* The script tag that {@link guide/dev_guide.bootstrap bootstraps} the angular environment.
|
||||
* The text {@link api/angular.widget.input input widget} which is bound to the greeting name text.
|
||||
* No need for listener registration and event firing on change events.
|
||||
* The implicit presence of the `name` variable which is in the root {@link api/angular.module.NG.$rootScope.Scope scope}.
|
||||
* The implicit presence of the `name` variable which is in the root {@link api/angular.module.ng.$rootScope.Scope scope}.
|
||||
* The double curly brace `{{markup}}`, which binds the name variable to the greeting text.
|
||||
* The concept of {@link guide/dev_guide.templates.databinding data binding}, which reflects any
|
||||
changes to the
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ allowing you to send links to specific screens in your app.
|
|||
|
||||
# Services
|
||||
|
||||
{@link api/angular.module.NG Services}: Services are long lived objects in your applications that are
|
||||
{@link api/angular.module.ng Services}: Services are long lived objects in your applications that are
|
||||
available across controllers. A collection of useful services are pre-bundled with angular but you
|
||||
will likely add your own. Services are initialized using dependency injection, which resolves the
|
||||
order of initialization. This safeguards you from the perils of global state (a common way to
|
||||
|
|
|
|||
|
|
@ -121,4 +121,4 @@ board variable.
|
|||
* The view can call any controller function.
|
||||
* In this example, the `setUrl()` and `readUrl()` functions copy the game state to/from the URL's
|
||||
hash so the browser's back button will undo game steps. See deep-linking. This example calls {@link
|
||||
api/angular.module.NG.$rootScope.Scope#$watch $watch()} to set up a listener that invokes `readUrl()` when needed.
|
||||
api/angular.module.ng.$rootScope.Scope#$watch $watch()} to set up a listener that invokes `readUrl()` when needed.
|
||||
|
|
|
|||
|
|
@ -98,4 +98,4 @@ APIs are bound to fields of this global object.
|
|||
|
||||
## Related API
|
||||
|
||||
{@link api/angular.module.NG.$compile Compiler API}
|
||||
{@link api/angular.module.ng.$compile Compiler API}
|
||||
|
|
|
|||
|
|
@ -43,4 +43,4 @@ an executable, bi-directionally bound application.
|
|||
|
||||
## Related API
|
||||
|
||||
{@link api/angular.module.NG.$compile Compiler API}
|
||||
{@link api/angular.module.ng.$compile Compiler API}
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ angular.directive('ng:bind', function(expression, compiledElement) {
|
|||
The angular compiler exposes methods that you may need to use when writing your own widgets and
|
||||
directives. For example, the `descend()` method lets you control whether the compiler ignores or
|
||||
processes child elements of the element it is compiling. For information on this and other
|
||||
compiler methods, see the {@link api/angular.module.NG.$compile Compiler API doc}.
|
||||
compiler methods, see the {@link api/angular.module.ng.$compile Compiler API doc}.
|
||||
|
||||
|
||||
## Related Docs
|
||||
|
|
|
|||
|
|
@ -93,4 +93,4 @@ corresponding spans.
|
|||
|
||||
## Related API
|
||||
|
||||
* {@link api/angular.module.NG.$compile $compile()}
|
||||
* {@link api/angular.module.ng.$compile $compile()}
|
||||
|
|
|
|||
|
|
@ -89,4 +89,4 @@ angular.attrMarkup('extraClass', function(attrValue, attrName, element){
|
|||
|
||||
## Related API
|
||||
|
||||
* {@link api/angular.module.NG.$compile Compiler API Reference}
|
||||
* {@link api/angular.module.ng.$compile Compiler API Reference}
|
||||
|
|
|
|||
|
|
@ -23,4 +23,4 @@ All compilation takes place in the web browser; no server is involved.
|
|||
|
||||
## Related API
|
||||
|
||||
* {@link api/angular.module.NG.$compile Angular Compiler API}
|
||||
* {@link api/angular.module.ng.$compile Angular Compiler API}
|
||||
|
|
|
|||
|
|
@ -14,4 +14,4 @@
|
|||
|
||||
## Related API
|
||||
|
||||
* {@link api/angular.module.NG.$compile $compile()}
|
||||
* {@link api/angular.module.ng.$compile $compile()}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ dataset]"`), the link function gets called to set up a listener on each element
|
|||
|
||||
Note that angular's built-in widgets, directives, and markup have predefined compile and link
|
||||
functions that you don't need to modify. When you create your own widgets, directives, or markup,
|
||||
you must write compile and link functions for them. Refer to the {@link api/angular.module.NG.$compile
|
||||
you must write compile and link functions for them. Refer to the {@link api/angular.module.ng.$compile
|
||||
Compiler API} for details.
|
||||
|
||||
When the angular compiler compiles a page, it proceeds through 3 phases: Compile, Create Root
|
||||
|
|
@ -53,7 +53,7 @@ Note that while the compile function is executed exactly once, the link function
|
|||
multiple times, for example, once for each iteration in a repeater.
|
||||
|
||||
The angular compiler exposes methods that you will need to make use of when writing your own
|
||||
widgets and directives. For information on these methods, see the {@link api/angular.module.NG.$compile
|
||||
widgets and directives. For information on these methods, see the {@link api/angular.module.ng.$compile
|
||||
Compiler API doc}.
|
||||
|
||||
|
||||
|
|
@ -65,4 +65,4 @@ Compiler API doc}.
|
|||
|
||||
## Related API
|
||||
|
||||
* {@link api/angular.module.NG.$compile $compile()}
|
||||
* {@link api/angular.module.ng.$compile $compile()}
|
||||
|
|
|
|||
|
|
@ -80,7 +80,7 @@ angular.widget('my:time', function(compileElement){
|
|||
The angular compiler exposes methods that you may need to use of when writing your own widgets and
|
||||
directives. For example, the `descend()` method lets you control whether the compiler ignores or
|
||||
processes child elements of the element it is compiling. For information on this and other
|
||||
compiler methods, see the {@link api/angular.module.NG.$compile Compiler API doc}.
|
||||
compiler methods, see the {@link api/angular.module.ng.$compile Compiler API doc}.
|
||||
|
||||
|
||||
## Related Topics
|
||||
|
|
@ -92,4 +92,4 @@ compiler methods, see the {@link api/angular.module.NG.$compile Compiler API doc
|
|||
|
||||
## Related API
|
||||
|
||||
* {@link api/angular.module.NG.$compile Compiler API}
|
||||
* {@link api/angular.module.ng.$compile Compiler API}
|
||||
|
|
|
|||
|
|
@ -32,4 +32,4 @@ dev_guide.compiler.widgets.creating_widgets Creating Custom Widgets}.
|
|||
|
||||
## Related API
|
||||
|
||||
* {@link api/angular.module.NG.$compile Compiler API}
|
||||
* {@link api/angular.module.ng.$compile Compiler API}
|
||||
|
|
|
|||
|
|
@ -28,5 +28,5 @@ book.
|
|||
|
||||
## Related API
|
||||
|
||||
* {@link api/angular.module.NG Service API}
|
||||
* {@link api/angular.module.ng Service API}
|
||||
* {@link api/angular.injector Angular Injector API}
|
||||
|
|
|
|||
|
|
@ -7,15 +7,15 @@ While DI is widely used in statically typed languages such as Java or C++, it ha
|
|||
used in JavaScript. Angular brings the benefits of DI into JavaScript apps.
|
||||
|
||||
In angular, DI is implemented as a subsystem that manages dependencies between services,
|
||||
controllers, widgets, and filters. The most important of these are {@link api/angular.module.NG
|
||||
controllers, widgets, and filters. The most important of these are {@link api/angular.module.ng
|
||||
services}.
|
||||
|
||||
Services are objects that handle common tasks in web applications. Angular provides several{@link
|
||||
api/angular.module.NG built-in services}, and you can create your own custom services.
|
||||
api/angular.module.ng built-in services}, and you can create your own custom services.
|
||||
|
||||
The main job of angular's DI subsystem is to provide services to angular components that depend on
|
||||
them. The way the DI subsystem provides services is as follows: all services are registered with
|
||||
angular's {@link api/angular.module.NG service API}, and all components that depend on services
|
||||
angular's {@link api/angular.module.ng service API}, and all components that depend on services
|
||||
define those dependencies as a property (`$inject`). With this information, the DI subsystem
|
||||
manages the creation of service objects and the provision of those objects to the components that
|
||||
need them, at the time they need them. The following illustration steps through the sequence of
|
||||
|
|
@ -49,7 +49,7 @@ achieve the necessary isolation by having each test create its own separate root
|
|||
|
||||
<pre>
|
||||
// create a root scope
|
||||
var rootScope = angular.module.NG.$rootScope.Scope();
|
||||
var rootScope = angular.module.ng.$rootScope.Scope();
|
||||
// access the service locator
|
||||
var myService = rootScope.$service('myService');
|
||||
</pre>
|
||||
|
|
@ -74,7 +74,7 @@ equivalent:
|
|||
|
||||
<pre>
|
||||
// given a user defined service
|
||||
angular.module.NG('serviceA', ...);
|
||||
angular.module.ng('serviceA', ...);
|
||||
|
||||
// inject '$window', 'serviceA', curry 'name';
|
||||
function fnA($window, serviceA, name){};
|
||||
|
|
@ -102,4 +102,4 @@ code and insert the `$inject` into the source code so that it can be minified/ob
|
|||
|
||||
## Related API
|
||||
|
||||
* {@link api/angular.module.NG Services API}
|
||||
* {@link api/angular.module.ng Services API}
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ MyController.$inject = ['$route'];
|
|||
</pre>
|
||||
|
||||
In this example, the `MyController` constructor function takes one argument, the {@link
|
||||
api/angular.module.NG.$route $route} service. Angular is then responsible for supplying the instance
|
||||
api/angular.module.ng.$route $route} service. Angular is then responsible for supplying the instance
|
||||
of `$route` to the controller when the constructor is instantiated. There are two ways to cause
|
||||
controller instantiation – by configuring routes with the `$route` service, or by referencing the
|
||||
controller from the HTML template, as follows:
|
||||
|
|
|
|||
|
|
@ -78,19 +78,19 @@ Returns the window.location.search of the currently loaded page in the test fram
|
|||
Returns the window.location.hash (without `#`) of the currently loaded page in the test frame.
|
||||
|
||||
## browser().location().url()
|
||||
Returns the {@link api/angular.module.NG.$location $location.url()} of the currently loaded page in
|
||||
Returns the {@link api/angular.module.ng.$location $location.url()} of the currently loaded page in
|
||||
the test frame.
|
||||
|
||||
## browser().location().path()
|
||||
Returns the {@link api/angular.module.NG.$location $location.path()} of the currently loaded page in
|
||||
Returns the {@link api/angular.module.ng.$location $location.path()} of the currently loaded page in
|
||||
the test frame.
|
||||
|
||||
## browser().location().search()
|
||||
Returns the {@link api/angular.module.NG.$location $location.search()} of the currently loaded page
|
||||
Returns the {@link api/angular.module.ng.$location $location.search()} of the currently loaded page
|
||||
in the test frame.
|
||||
|
||||
## browser().location().hash()
|
||||
Returns the {@link api/angular.module.NG.$location $location.hash()} of the currently loaded page in
|
||||
Returns the {@link api/angular.module.ng.$location $location.hash()} of the currently loaded page in
|
||||
the test frame.
|
||||
|
||||
## expect(future).{matcher}
|
||||
|
|
|
|||
|
|
@ -165,15 +165,15 @@ JavaScript method instead.
|
|||
Built-in types have methods like `[].push()`, but the richness of these methods is limited.
|
||||
Consider the example below, which allows you to do a simple search over a canned set of contacts.
|
||||
The example would be much more complicated if we did not have the `Array:$filter()`. There is no
|
||||
built-in method on `Array` called {@link api/angular.module.NG.$filter.filter $filter} and angular doesn't add
|
||||
built-in method on `Array` called {@link api/angular.module.ng.$filter.filter $filter} and angular doesn't add
|
||||
it to `Array.prototype` because that could collide with other JavaScript frameworks.
|
||||
|
||||
For this reason the scope expression evaluator augments the built-in types to make them act like
|
||||
they have extra methods. The actual method for `$filter()` is `angular.module.NG.$filter.filter()`. You can
|
||||
they have extra methods. The actual method for `$filter()` is `angular.module.ng.$filter.filter()`. You can
|
||||
call it from JavaScript.
|
||||
|
||||
Extensions: You can further extend the expression vocabulary by adding new methods to
|
||||
`angular.module.NG.$filter` or `angular.String`, etc.
|
||||
`angular.module.ng.$filter` or `angular.String`, etc.
|
||||
|
||||
<doc:example>
|
||||
<doc:source>
|
||||
|
|
@ -212,7 +212,7 @@ of filters like this:
|
|||
|
||||
name | uppercase
|
||||
|
||||
The expression evaluator simply passes the value of name to angular.module.NG.$filter.uppercase.
|
||||
The expression evaluator simply passes the value of name to angular.module.ng.$filter.uppercase.
|
||||
|
||||
Chain filters using this syntax:
|
||||
|
||||
|
|
@ -243,4 +243,4 @@ so that angular developers and developers who use angular can develop in harmony
|
|||
|
||||
## Related API
|
||||
|
||||
* {@link api/angular.module.NG.$compile Angular Compiler API}
|
||||
* {@link api/angular.module.ng.$compile Angular Compiler API}
|
||||
|
|
|
|||
|
|
@ -18,14 +18,14 @@ Forms consist of all of the following:
|
|||
|
||||
A form groups a set of widgets together into a single logical data-set. A form is created using
|
||||
the {@link api/angular.widget.form <form>} element that calls the
|
||||
{@link api/angular.module.NG.$formFactory $formFactory} service. The form is responsible for managing
|
||||
{@link api/angular.module.ng.$formFactory $formFactory} service. The form is responsible for managing
|
||||
the widgets and for tracking validation information.
|
||||
|
||||
A form is:
|
||||
|
||||
- The collection which contains widgets or other forms.
|
||||
- Responsible for marshaling data from the model into a widget. This is
|
||||
triggered by {@link api/angular.module.NG.$rootScope.Scope#$watch $watch} of the model expression.
|
||||
triggered by {@link api/angular.module.ng.$rootScope.Scope#$watch $watch} of the model expression.
|
||||
- Responsible for marshaling data from the widget into the model. This is
|
||||
triggered by the widget emitting the `$viewChange` event.
|
||||
- Responsible for updating the validation state of the widget, when the widget emits
|
||||
|
|
@ -57,7 +57,7 @@ In Angular, a widget is the term used for the UI with which the user input. Exam
|
|||
bult-in Angular widgets are {@link api/angular.widget.input input} and
|
||||
{@link api/angular.widget.select select}. Widgets provide the rendering and the user
|
||||
interaction logic. Widgets should be declared inside a form, if no form is provided an implicit
|
||||
form {@link api/angular.module.NG.$formFactory $formFactory.rootForm} form is used.
|
||||
form {@link api/angular.module.ng.$formFactory $formFactory.rootForm} form is used.
|
||||
|
||||
Widgets are implemented as Angular controllers. A widget controller:
|
||||
|
||||
|
|
@ -218,7 +218,7 @@ The following example demonstrates:
|
|||
# Life-cycle
|
||||
|
||||
- The `<form>` element triggers creation of a new form {@link dev_guide.scopes scope} using the
|
||||
{@link api/angular.module.NG.$formFactory $formfactory}. The new form scope is added to the
|
||||
{@link api/angular.module.ng.$formFactory $formfactory}. The new form scope is added to the
|
||||
`<form>` element using the jQuery `.data()` method for later retrieval under the key `$form`.
|
||||
The form also sets up these listeners:
|
||||
|
||||
|
|
@ -227,8 +227,8 @@ The following example demonstrates:
|
|||
- `$valid` / `$invalid` - This event is emitted by the widget on validation state change.
|
||||
|
||||
- `<input>` element triggers the creation of the widget using the
|
||||
{@link api/angular.module.NG.$formFactory $formfactory.$createWidget()} method. The `$createWidget()`
|
||||
creates new widget instance by calling the current scope {@link api/angular.module.NG.$rootScope.Scope#$new .$new()} and
|
||||
{@link api/angular.module.ng.$formFactory $formfactory.$createWidget()} method. The `$createWidget()`
|
||||
creates new widget instance by calling the current scope {@link api/angular.module.ng.$rootScope.Scope#$new .$new()} and
|
||||
registers these listeners:
|
||||
|
||||
- `$watch` on the model scope.
|
||||
|
|
@ -244,7 +244,7 @@ The following example demonstrates:
|
|||
1. The DOM element fires the `change` event which the widget intercepts. Widget then emits
|
||||
a `$viewChange` event which includes the new user-entered value. (Remember that the DOM events
|
||||
are outside of the Angular environment so the widget must emit its event within the
|
||||
{@link api/angular.module.NG.$rootScope.Scope#$apply $apply} method).
|
||||
{@link api/angular.module.ng.$rootScope.Scope#$apply $apply} method).
|
||||
2. The form's `$viewChange` listener copies the user-entered value to the widget's `$viewValue`
|
||||
property. Since the `$viewValue` is the raw value as entered by user, it may need to be
|
||||
translated to a different format/type (for example, translating a string to a number).
|
||||
|
|
@ -517,7 +517,7 @@ function LoginController() {
|
|||
|
||||
describe('LoginController', function() {
|
||||
it('should disable login button when form is invalid', function() {
|
||||
var scope = angular.module.NG.$rootScope.Scope();
|
||||
var scope = angular.module.ng.$rootScope.Scope();
|
||||
var loginController = scope.$new(LoginController);
|
||||
|
||||
// In production the 'loginForm' form instance gets set from the view,
|
||||
|
|
@ -570,7 +570,7 @@ function LoginController(){
|
|||
|
||||
describe('LoginController', function() {
|
||||
it('should disable login button when form is invalid', function() {
|
||||
var scope = angular.module.NG.$rootScope.Scope();
|
||||
var scope = angular.module.ng.$rootScope.Scope();
|
||||
var loginController = scope.$new(LoginController);
|
||||
var input = angular.element('<input>');
|
||||
|
||||
|
|
|
|||
|
|
@ -17,15 +17,15 @@ abstracted bits.
|
|||
**What level of support for i18n/l10n is currently in Angular?**
|
||||
|
||||
Currently, Angular supports i18n/l10n for {@link
|
||||
http://docs.angularjs.org/#!/api/angular.module.NG.$filter.date datetime}, {@link
|
||||
http://docs.angularjs.org/#!/api/angular.module.NG.$filter.number number} and {@link
|
||||
http://docs.angularjs.org/#!/api/angular.module.NG.$filter.currency currency} filters.
|
||||
http://docs.angularjs.org/#!/api/angular.module.ng.$filter.date datetime}, {@link
|
||||
http://docs.angularjs.org/#!/api/angular.module.ng.$filter.number number} and {@link
|
||||
http://docs.angularjs.org/#!/api/angular.module.ng.$filter.currency currency} filters.
|
||||
|
||||
Additionally, Angular supports localizable pluralization support provided by the {@link
|
||||
api/angular.widget.ng:pluralize ng:pluralize widget}.
|
||||
|
||||
All localizable Angular components depend on locale-specific rule sets managed by the {@link
|
||||
api/angular.module.NG.$locale $locale service}.
|
||||
api/angular.module.ng.$locale $locale service}.
|
||||
|
||||
For readers who want to jump straight into examples, we have a few web pages that showcase how to
|
||||
use Angular filters with various locale rule sets. You can find these examples either on {@link
|
||||
|
|
@ -90,8 +90,8 @@ because an extra script needs to be loaded.
|
|||
|
||||
**Currency symbol "gotcha"**
|
||||
|
||||
Angular's {@link http://docs.angularjs.org/#!/api/angular.module.NG.$filter.currency currency filter} allows
|
||||
you to use the default currency symbol from the {@link api/angular.module.NG.$locale locale service},
|
||||
Angular's {@link http://docs.angularjs.org/#!/api/angular.module.ng.$filter.currency currency filter} allows
|
||||
you to use the default currency symbol from the {@link api/angular.module.ng.$locale locale service},
|
||||
or you can provide the filter with a custom currency symbol. If your app will be used only in one
|
||||
locale, it is fine to rely on the default currency symbol. However, if you anticipate that viewers
|
||||
in other locales might use your app, you should provide your own currency symbol to make sure the
|
||||
|
|
@ -104,7 +104,7 @@ browser will specify the locale as ja, and the balance of '¥1000.00' will be sh
|
|||
will really upset your client.
|
||||
|
||||
In this case, you need to override the default currency symbol by providing the {@link
|
||||
http://docs.angularjs.org/#!/api/angular.module.NG.$filter.currency currency filter} with a currency symbol as
|
||||
http://docs.angularjs.org/#!/api/angular.module.ng.$filter.currency currency filter} with a currency symbol as
|
||||
a parameter when you configure the filter, for example, {{ 1000 | currency:"USD$"}}. This way,
|
||||
Angular will always show a balance of 'USD$1000' and disregard any locale changes.
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
In angular, a controller is a JavaScript function(type/class) that is used to augment instances of
|
||||
angular {@link dev_guide.scopes Scope}, excluding the root scope. When you or angular create a new
|
||||
child scope object via the {@link api/angular.module.NG.$rootScope.Scope#$new scope.$new} API , there is an
|
||||
child scope object via the {@link api/angular.module.ng.$rootScope.Scope#$new scope.$new} API , there is an
|
||||
option to pass in a controller as a method argument. This will tell angular to associate the
|
||||
controller with the new scope and to augment its behavior.
|
||||
|
||||
|
|
@ -77,9 +77,9 @@ instances).
|
|||
|
||||
# Associating Controllers with Angular Scope Objects
|
||||
|
||||
You can associate controllers with scope objects explicitly via the {@link api/angular.module.NG.$rootScope.Scope#$new
|
||||
You can associate controllers with scope objects explicitly via the {@link api/angular.module.ng.$rootScope.Scope#$new
|
||||
scope.$new} api or implicitly via the {@link api/angular.directive.ng:controller ng:controller
|
||||
directive} or {@link api/angular.module.NG.$route $route service}.
|
||||
directive} or {@link api/angular.module.ng.$route $route service}.
|
||||
|
||||
|
||||
## Controller Constructor and Methods Example
|
||||
|
|
@ -160,7 +160,7 @@ input box) in the second button.
|
|||
|
||||
## Controller Inheritance Example
|
||||
|
||||
Controller inheritance in angular is based on {@link api/angular.module.NG.$rootScope.Scope Scope} inheritance. Let's
|
||||
Controller inheritance in angular is based on {@link api/angular.module.ng.$rootScope.Scope Scope} inheritance. Let's
|
||||
have a look at an example:
|
||||
|
||||
<pre>
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@ pattern, a scope's properties comprise both the model and the controller methods
|
|||
|
||||
|
||||
### Scope characteristics
|
||||
- Scopes provide APIs ({@link api/angular.module.NG.$rootScope.Scope#$watch $watch}) to observe model mutations.
|
||||
- Scopes provide APIs ({@link api/angular.module.NG.$rootScope.Scope#$apply $apply}) to propagate any model changes
|
||||
- Scopes provide APIs ({@link api/angular.module.ng.$rootScope.Scope#$watch $watch}) to observe model mutations.
|
||||
- Scopes provide APIs ({@link api/angular.module.ng.$rootScope.Scope#$apply $apply}) to propagate any model changes
|
||||
through the system into the view from outside of the "Angular realm" (controllers, services,
|
||||
Angular event handlers).
|
||||
- Scopes can be nested to isolate application components while providing access to shared model
|
||||
|
|
@ -27,14 +27,14 @@ Every application has a root scope, which is the ancestor of all other scopes.
|
|||
|
||||
### What is scope used for?
|
||||
|
||||
{@link dev_guide.expressions Expressions} in the view are {@link api/angular.module.NG.$rootScope.Scope#$eval evaluated}
|
||||
{@link dev_guide.expressions Expressions} in the view are {@link api/angular.module.ng.$rootScope.Scope#$eval evaluated}
|
||||
against the current scope. When HTML DOM elements are attached to a scope, expressions in those
|
||||
elements are evaluated against the attached scope.
|
||||
|
||||
There are two kinds of expressions:
|
||||
|
||||
- Binding expressions, which are observations of property changes. Property changes are reflected
|
||||
in the view during the {@link api/angular.module.NG.$rootScope.Scope#$digest digest cycle}.
|
||||
in the view during the {@link api/angular.module.ng.$rootScope.Scope#$digest digest cycle}.
|
||||
- Action expressions, which are expressions with side effects. Typically, the side effects cause
|
||||
execution of a method in a controller in response to a user action, such as clicking on a button.
|
||||
|
||||
|
|
@ -57,7 +57,7 @@ A property write will always write to the current scope. This means that a write
|
|||
property within the scope it writes to, as shown in the following example.
|
||||
|
||||
<pre>
|
||||
var root = angular.module.NG.$rootScope.Scope();
|
||||
var root = angular.module.ng.$rootScope.Scope();
|
||||
var child = root.$new();
|
||||
|
||||
root.name = 'angular';
|
||||
|
|
@ -73,25 +73,25 @@ expect(root.name).toEqual('angular');
|
|||
### Scope life cycle
|
||||
1. **Creation**
|
||||
|
||||
* The root scope is created by the {@link api/angular.module.NG.$rootScope $rootScope} service.
|
||||
* To create a child scopes, you should call {@link api/angular.module.NG.$rootScope.Scope#$new parentScope.$new()}.
|
||||
* The root scope is created by the {@link api/angular.module.ng.$rootScope $rootScope} service.
|
||||
* To create a child scopes, you should call {@link api/angular.module.ng.$rootScope.Scope#$new parentScope.$new()}.
|
||||
|
||||
2. **Watcher registration**
|
||||
|
||||
Watcher registration can happen at any time and on any scope (root or child) via {@link
|
||||
api/angular.module.NG.$rootScope.Scope#$watch scope.$watch()} API.
|
||||
api/angular.module.ng.$rootScope.Scope#$watch scope.$watch()} API.
|
||||
|
||||
3. **Model mutation**
|
||||
|
||||
For mutations to be properly observed, you should make them only within the execution of the
|
||||
function passed into {@link api/angular.module.NG.$rootScope.Scope#$apply scope.$apply()} call. (Angular apis do this
|
||||
function passed into {@link api/angular.module.ng.$rootScope.Scope#$apply scope.$apply()} call. (Angular apis do this
|
||||
implicitly, so no extra `$apply` call is needed when doing synchronous work in controllers, or
|
||||
asynchronous work with {@link api/angular.module.NG.$xhr $xhr} or {@link api/angular.module.NG.$defer
|
||||
asynchronous work with {@link api/angular.module.ng.$xhr $xhr} or {@link api/angular.module.ng.$defer
|
||||
$defer} services.
|
||||
|
||||
4. **Mutation observation**
|
||||
|
||||
At the end of each `$apply` call {@link api/angular.module.NG.$rootScope.Scope#$digest $digest} cycle is started on
|
||||
At the end of each `$apply` call {@link api/angular.module.ng.$rootScope.Scope#$digest $digest} cycle is started on
|
||||
the root scope, which then propagates throughout all child scopes.
|
||||
|
||||
During the `$digest` cycle, all `$watch-ers` expressions or functions are checked for model
|
||||
|
|
@ -100,7 +100,7 @@ mutation and if a mutation is detected, the `$watch-er` listener is called.
|
|||
5. **Scope destruction**
|
||||
|
||||
When child scopes are no longer needed, it is the responsibility of the child scope creator to
|
||||
destroy them via {@link api/angular.module.NG.$rootScope.Scope#$destroy scope.$destroy()} API. This will stop
|
||||
destroy them via {@link api/angular.module.ng.$rootScope.Scope#$destroy scope.$destroy()} API. This will stop
|
||||
propagation of `$digest` calls into the child scope and allow for memory used by the child scope
|
||||
models to be reclaimed by the garbage collector.
|
||||
|
||||
|
|
@ -118,22 +118,22 @@ element.
|
|||
api/angular.directive directives} against the DOM template. The directives usually fall into one of
|
||||
two categories:
|
||||
- Observing {@link api/angular.directive directives}, such as double-curly expressions
|
||||
`{{expression}}`, register listeners using the {@link api/angular.module.NG.$rootScope.Scope#$watch $watch()} method.
|
||||
`{{expression}}`, register listeners using the {@link api/angular.module.ng.$rootScope.Scope#$watch $watch()} method.
|
||||
This type of directive needs to be notified whenever the expression changes so that it can update
|
||||
the view.
|
||||
- Listener directives, such as {@link api/angular.directive.ng:click ng:click}, register a
|
||||
listener with the DOM. When the DOM listener fires, the directive executes the associated
|
||||
expression and updates the view using the {@link api/angular.module.NG.$rootScope.Scope#$apply $apply()} method.
|
||||
expression and updates the view using the {@link api/angular.module.ng.$rootScope.Scope#$apply $apply()} method.
|
||||
3. When an external event (such as a user action, timer or XHR) is received, the associated {@link
|
||||
dev_guide.expressions expression} must be applied to the scope through the {@link
|
||||
api/angular.module.NG.$rootScope.Scope#$apply $apply()} method so that all listeners are updated correctly.
|
||||
api/angular.module.ng.$rootScope.Scope#$apply $apply()} method so that all listeners are updated correctly.
|
||||
|
||||
|
||||
### Directives that create scopes
|
||||
In most cases, {@link api/angular.directive directives} and scopes interact but do not create new
|
||||
instances of scope. However, some directives, such as {@link api/angular.directive.ng:controller
|
||||
ng:controller} and {@link api/angular.widget.@ng:repeat ng:repeat}, create new child scopes using
|
||||
the {@link api/angular.module.NG.$rootScope.Scope#$new $new()} method and then attach the child scope to the
|
||||
the {@link api/angular.module.ng.$rootScope.Scope#$new $new()} method and then attach the child scope to the
|
||||
corresponding DOM element. You can retrieve a scope for any DOM element by using an
|
||||
`angular.element(aDomElement).scope()` method call.)
|
||||
|
||||
|
|
@ -143,13 +143,13 @@ Scopes and controllers interact with each other in the following situations:
|
|||
- Controllers use scopes to expose controller methods to templates (see {@link
|
||||
api/angular.directive.ng:controller ng:controller}).
|
||||
- Controllers define methods (behavior) that can mutate the model (properties on the scope).
|
||||
- Controllers may register {@link api/angular.module.NG.$rootScope.Scope#$watch watches} on the model. These watches
|
||||
- Controllers may register {@link api/angular.module.ng.$rootScope.Scope#$watch watches} on the model. These watches
|
||||
execute immediately after the controller behavior executes, but before the DOM gets updated.
|
||||
|
||||
See the {@link dev_guide.mvc.understanding_controller controller docs} for more information.
|
||||
|
||||
### Updating scope properties
|
||||
You can update a scope by calling its {@link api/angular.module.NG.$rootScope.Scope#$apply $apply()} method with an
|
||||
You can update a scope by calling its {@link api/angular.module.ng.$rootScope.Scope#$apply $apply()} method with an
|
||||
expression or a function as the function argument. However it is typically not necessary to do this
|
||||
explicitly. In most cases, angular intercepts all external events (such as user interactions, XHRs,
|
||||
and timers) and wraps their callbacks into the `$apply()` method call on the scope object for you
|
||||
|
|
@ -172,8 +172,8 @@ doesn't need to worry about propagating the `$digest` call from the parent scope
|
|||
This happens automatically.
|
||||
|
||||
## Scopes in unit-testing
|
||||
You can create scopes, including the root scope, in tests using the {@link api/angular.module.NG.$rootScope.Scope
|
||||
angular.module.NG.$rootScope.Scope()} API. This allows you to mimic the run-time environment and have full control over
|
||||
You can create scopes, including the root scope, in tests using the {@link api/angular.module.ng.$rootScope.Scope
|
||||
angular.module.ng.$rootScope.Scope()} API. This allows you to mimic the run-time environment and have full control over
|
||||
the life cycle of the scope so that you can assert correct model transitions. Since these scopes
|
||||
are created outside the normal compilation process, their life cycles must be managed by the test.
|
||||
|
||||
|
|
@ -183,7 +183,7 @@ within the unit-tests.
|
|||
|
||||
<pre>
|
||||
// example of a test
|
||||
var scope = angular.module.NG.$rootScope.Scope();
|
||||
var scope = angular.module.ng.$rootScope.Scope();
|
||||
scope.$watch('name', function(scope, name){
|
||||
scope.greeting = 'Hello ' + name + '!';
|
||||
});
|
||||
|
|
@ -221,5 +221,5 @@ it('should allow override of providers', inject(
|
|||
|
||||
## Related API
|
||||
|
||||
* {@link api/angular.module.NG.$rootScope.Scope Angular Scope API}
|
||||
* {@link api/angular.module.ng.$rootScope.Scope Angular Scope API}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,15 +13,15 @@ the contexts in which Angular creates data-bindings between the model and the vi
|
|||
|
||||
In addition to providing the context in which data is evaluated, Angular scope objects watch for
|
||||
model changes. The scope objects also notify all components interested in any model changes (for
|
||||
example, functions registered through {@link api/angular.module.NG.$rootScope.Scope#$watch $watch}, bindings created by
|
||||
example, functions registered through {@link api/angular.module.ng.$rootScope.Scope#$watch $watch}, bindings created by
|
||||
{@link api/angular.directive.ng:bind ng:bind}, or HTML input elements).
|
||||
|
||||
Angular scope objects:
|
||||
|
||||
* Link the model, controller and view template together.
|
||||
* Provide the mechanism to watch for model changes ({@link api/angular.module.NG.$rootScope.Scope#$watch $watch}).
|
||||
* Apply model changes to the system ({@link api/angular.module.NG.$rootScope.Scope#$apply $apply}).
|
||||
* Provide the context in which expressions are evaluated ({@link api/angular.module.NG.$rootScope.Scope#$eval $eval}).
|
||||
* Provide the mechanism to watch for model changes ({@link api/angular.module.ng.$rootScope.Scope#$watch $watch}).
|
||||
* Apply model changes to the system ({@link api/angular.module.ng.$rootScope.Scope#$apply $apply}).
|
||||
* Provide the context in which expressions are evaluated ({@link api/angular.module.ng.$rootScope.Scope#$eval $eval}).
|
||||
|
||||
|
||||
## Related Topics
|
||||
|
|
@ -31,5 +31,5 @@ Angular scope objects:
|
|||
|
||||
## Related API
|
||||
|
||||
* {@link api/angular.module.NG.$rootScope.Scope Angular Scope API}
|
||||
* {@link api/angular.module.ng.$rootScope.Scope Angular Scope API}
|
||||
|
||||
|
|
|
|||
|
|
@ -63,4 +63,4 @@ The following illustration shows the DOM and angular scopes for the example abov
|
|||
|
||||
## Related API
|
||||
|
||||
* {@link api/angular.module.NG.$rootScope.Scope Angular Scope API}
|
||||
* {@link api/angular.module.ng.$rootScope.Scope Angular Scope API}
|
||||
|
|
|
|||
|
|
@ -89,7 +89,8 @@ setter methods that allow you to get or change the current URL in the browser.
|
|||
## $location service configuration
|
||||
|
||||
To configure the `$location` service, retrieve the
|
||||
{@link api/angular.module.NG.$locationProvider $locationProvider} and set the parameters as follows:
|
||||
{@link api/angular.module.ng.$locationProvider $locationProvider} and set the parameters as follows:
|
||||
|
||||
|
||||
- **html5Mode(mode)**: {boolean}<br />
|
||||
`true` - see HTML5 mode<br />
|
||||
|
|
@ -133,7 +134,7 @@ current URL without creating a new browser history record you can call:
|
|||
</pre>
|
||||
|
||||
Note that the setters don't update `window.location` immediately. Instead, `$location` service is
|
||||
aware of the {@link api/angular.module.NG.$rootScope.Scope scope} life-cycle and coalesces multiple `$location`
|
||||
aware of the {@link api/angular.module.ng.$rootScope.Scope scope} life-cycle and coalesces multiple `$location`
|
||||
mutations into one "commit" to the `window.location` object during the scope `$digest` phase. Since
|
||||
multiple changes to the $location's state will be pushed to the browser as a single change, it's
|
||||
enough to call the `replace()` method just once to make the entire "commit" a replace operation
|
||||
|
|
@ -487,11 +488,11 @@ In this examples we use `<base href="/base/index.html" />`
|
|||
|
||||
The `$location` service allows you to change only the URL; it does not allow you to reload the
|
||||
page. When you need to change the URL and reload the page or navigate to a different page, please
|
||||
use a lower level API, {@link api/angular.module.NG.$window $window.location.href}.
|
||||
use a lower level API, {@link api/angular.module.ng.$window $window.location.href}.
|
||||
|
||||
## Using $location outside of the scope life-cycle
|
||||
|
||||
`$location` knows about Angular's {@link api/angular.module.NG.$rootScope.Scope scope} life-cycle. When a URL changes in
|
||||
`$location` knows about Angular's {@link api/angular.module.ng.$rootScope.Scope scope} life-cycle. When a URL changes in
|
||||
the browser it updates the `$location` and calls `$apply` so that all $watchers / $observers are
|
||||
notified.
|
||||
When you change the `$location` inside the `$digest` phase everything is ok; `$location` will
|
||||
|
|
@ -511,7 +512,7 @@ hashPrefix.
|
|||
# Testing with the $location service
|
||||
|
||||
When using `$location` service during testing, you are outside of the angular's {@link
|
||||
api/angular.module.NG.$rootScope.Scope scope} life-cycle. This means it's your responsibility to call `scope.$apply()`.
|
||||
api/angular.module.ng.$rootScope.Scope scope} life-cycle. This means it's your responsibility to call `scope.$apply()`.
|
||||
|
||||
<pre>
|
||||
describe('serviceUnderTest', function() {
|
||||
|
|
@ -629,7 +630,7 @@ this.$watch('$location.path()', function(scope, path) {
|
|||
|
||||
# Related API
|
||||
|
||||
* {@link api/angular.module.NG.$location $location API}
|
||||
* {@link api/angular.module.ng.$location $location API}
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ While angular offers several useful services, for any nontrivial application you
|
|||
to write your own custom services. To do this you begin by registering a service factory function
|
||||
that angular's DI will use to create the service object when it is needed.
|
||||
|
||||
The `angular.module.NG` method accepts three parameters:
|
||||
The `angular.module.ng` method accepts three parameters:
|
||||
|
||||
- `{string} name` - Name of the service.
|
||||
- `{function()} factory` - Factory function(called just once by DI).
|
||||
|
|
@ -32,7 +32,7 @@ stores all notifications; after the third one, the service displays all of the n
|
|||
window alert.
|
||||
|
||||
<pre>
|
||||
angular.module.NG('notify', function(win) {
|
||||
angular.module.ng('notify', function(win) {
|
||||
var msgs = [];
|
||||
return function(msg) {
|
||||
msgs.push(msg);
|
||||
|
|
@ -55,4 +55,4 @@ window alert.
|
|||
|
||||
## Related API
|
||||
|
||||
* {@link api/angular.module.NG Angular Service API}
|
||||
* {@link api/angular.module.ng Angular Service API}
|
||||
|
|
|
|||
|
|
@ -77,4 +77,4 @@ it('should test service', function() {
|
|||
|
||||
## Related API
|
||||
|
||||
{@link api/angular.module.NG Angular Service API}
|
||||
{@link api/angular.module.ng Angular Service API}
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ provided by angular's web framework:
|
|||
*
|
||||
* @param {*} message Message to be logged.
|
||||
*/
|
||||
angular.module.NG('batchLog', function($defer, $log) {
|
||||
angular.module.ng('batchLog', function($defer, $log) {
|
||||
var messageQueue = [];
|
||||
|
||||
function log() {
|
||||
|
|
@ -43,7 +43,7 @@ angular.module.NG('batchLog', function($defer, $log) {
|
|||
* routeTemplateMonitor monitors each $route change and logs the current
|
||||
* template via the batchLog service.
|
||||
*/
|
||||
angular.module.NG('routeTemplateMonitor', function($route, batchLog) {
|
||||
angular.module.ng('routeTemplateMonitor', function($route, batchLog) {
|
||||
this.$on('$afterRouteChange', function() {
|
||||
batchLog($route.current ? $route.current.template : null);
|
||||
});
|
||||
|
|
@ -52,10 +52,10 @@ angular.module.NG('routeTemplateMonitor', function($route, batchLog) {
|
|||
|
||||
Things to notice in this example:
|
||||
|
||||
* The `batchLog` service depends on the built-in {@link api/angular.module.NG.$defer $defer} and
|
||||
{@link api/angular.module.NG.$log $log} services, and allows messages to be logged into the
|
||||
* The `batchLog` service depends on the built-in {@link api/angular.module.ng.$defer $defer} and
|
||||
{@link api/angular.module.ng.$log $log} services, and allows messages to be logged into the
|
||||
`console.log` in batches.
|
||||
* The `routeTemplateMonitor` service depends on the built-in {@link api/angular.module.NG.$route
|
||||
* The `routeTemplateMonitor` service depends on the built-in {@link api/angular.module.ng.$route
|
||||
$route} service as well as our custom `batchLog` service.
|
||||
* The `routeTemplateMonitor` service is declared to be eager, so that it is started as soon as the
|
||||
application starts.
|
||||
|
|
@ -80,5 +80,5 @@ order to inject.
|
|||
|
||||
## Related API
|
||||
|
||||
* {@link api/angular.module.NG Angular Service API}
|
||||
* {@link api/angular.module.ng Angular Service API}
|
||||
* {@link api/angular.injector Angular Injector API}
|
||||
|
|
|
|||
|
|
@ -19,4 +19,4 @@ most often used with {@link dev_guide.di dependency injection}, also a key featu
|
|||
|
||||
## Related API
|
||||
|
||||
* {@link api/angular.module.NG Angular Service API}
|
||||
* {@link api/angular.module.ng Angular Service API}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ which happens when the angular {@link dev_guide.bootstrap application initialize
|
|||
To override the default, you can request that a service is eagerly instantiated as follows:
|
||||
|
||||
<pre>
|
||||
angular.module.NG('service id', function() {
|
||||
angular.module.ng('service id', function() {
|
||||
var shinyNewServiceInstance;
|
||||
//factory function body that constructs shinyNewServiceInstance
|
||||
return shinyNewServiceInstance;
|
||||
|
|
@ -65,4 +65,4 @@ important.
|
|||
|
||||
## Related API
|
||||
|
||||
* {@link api/angular.module.NG Angular Service API}
|
||||
* {@link api/angular.module.ng Angular Service API}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ var mock, notify;
|
|||
|
||||
beforeEach(function() {
|
||||
mock = {alert: jasmine.createSpy()};
|
||||
notify = angular.module.NG('notify')(mock);
|
||||
notify = angular.module.ng('notify')(mock);
|
||||
});
|
||||
|
||||
it('should not alert first two notifications', function() {
|
||||
|
|
@ -53,6 +53,6 @@ it('should clear messages after alert', function() {
|
|||
|
||||
## Related API
|
||||
|
||||
* {@link api/angular.module.NG Angular Service API}
|
||||
* {@link api/angular.module.ng Angular Service API}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
@description
|
||||
|
||||
Angular services are singletons that carry out specific tasks common to web apps, such as the
|
||||
{@link api/angular.module.NG.$xhr $xhr service} that provides low level access to the browser's
|
||||
{@link api/angular.module.ng.$xhr $xhr service} that provides low level access to the browser's
|
||||
`XMLHttpRequest` object.
|
||||
|
||||
To use an angular service, you identify it as a dependency for the dependent (a controller, or
|
||||
|
|
@ -33,5 +33,5 @@ above). You can also create your own custom services.
|
|||
|
||||
## Related API
|
||||
|
||||
* {@link api/angular.module.NG Angular Service API}
|
||||
* {@link api/angular.module.ng Angular Service API}
|
||||
* {@link api/angular.injector Injector API}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
@name Developer Guide: Templates: Filters: Creating Angular Filters
|
||||
@description
|
||||
|
||||
Writing your own filter is very easy: just define a JavaScript function on the `angular.module.NG.$filter`
|
||||
Writing your own filter is very easy: just define a JavaScript function on the `angular.module.ng.$filter`
|
||||
object.
|
||||
The framework passes in the input value as the first argument to your function. Any filter
|
||||
arguments are passed in as additional function arguments.
|
||||
|
|
@ -64,4 +64,4 @@ angular.module.MyReverseModule = function MyModule($filterProvider) {
|
|||
|
||||
## Related API
|
||||
|
||||
* {@link api/angular.module.NG.$filter Angular Filter API}
|
||||
* {@link api/angular.module.ng.$filter Angular Filter API}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ displaying it to the user. You can pass expressions through a chain of filters l
|
|||
|
||||
name | uppercase
|
||||
|
||||
The expression evaluator simply passes the value of name to `angular.module.NG.$filter.uppercase()`.
|
||||
The expression evaluator simply passes the value of name to `angular.module.ng.$filter.uppercase()`.
|
||||
|
||||
In addition to formatting data, filters can also modify the DOM. This allows filters to handle
|
||||
tasks such as conditionally applying CSS styles to filtered output.
|
||||
|
|
@ -24,4 +24,4 @@ tasks such as conditionally applying CSS styles to filtered output.
|
|||
|
||||
## Related API
|
||||
|
||||
* {@link api/angular.module.NG.$filter Angular Filter API}
|
||||
* {@link api/angular.module.ng.$filter Angular Filter API}
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
@name Developer Guide: Templates: Filters: Using Angular Filters
|
||||
@description
|
||||
|
||||
Filters can be part of any {@link api/angular.module.NG.$rootScope.Scope} evaluation but are typically used to format
|
||||
Filters can be part of any {@link api/angular.module.ng.$rootScope.Scope} evaluation but are typically used to format
|
||||
expressions in bindings in your templates:
|
||||
|
||||
{{ expression | filter }}
|
||||
|
|
@ -37,4 +37,4 @@ argument that specifies how many digits to display to the right of the decimal p
|
|||
|
||||
## Related API
|
||||
|
||||
* {@link api/angular.module.NG.$filter Angular Filter API}
|
||||
* {@link api/angular.module.ng.$filter Angular Filter API}
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ and {@link dev_guide.expressions expressions}:
|
|||
In a simple single-page app, the template consists of HTML, CSS, and angular directives contained
|
||||
in just one HTML file (usually `index.html`). In a more complex app, you can display multiple views
|
||||
within one main page using "partials", which are segments of template located in separate HTML
|
||||
files. You "include" the partials in the main page using the {@link api/angular.module.NG.$route
|
||||
files. You "include" the partials in the main page using the {@link api/angular.module.ng.$route
|
||||
$route} service in conjunction with the {@link api/angular.widget.ng:view ng:view} directive. An
|
||||
example of this technique is shown in the {@link tutorial/ angular tutorial}, in steps seven and
|
||||
eight.
|
||||
|
|
|
|||
|
|
@ -247,16 +247,16 @@ that such a test tells a story, rather then asserting random bits which don't se
|
|||
|
||||
|
||||
## Filters
|
||||
{@link api/angular.module.NG.$filter Filters} are functions which transform the data into user readable
|
||||
{@link api/angular.module.ng.$filter Filters} are functions which transform the data into user readable
|
||||
format. They are important because they remove the formatting responsibility from the application
|
||||
logic, further simplifying the application logic.
|
||||
|
||||
<pre>
|
||||
angular.module.NG.$filter('length', function(text){
|
||||
angular.module.ng.$filter('length', function(text){
|
||||
return (''+(text||'')).length;
|
||||
});
|
||||
|
||||
var length = angular.module.NG.$filter('length');
|
||||
var length = angular.module.ng.$filter('length');
|
||||
expect(length(null)).toEqual(0);
|
||||
expect(length('abc')).toEqual(3);
|
||||
</pre>
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ manipulate the DOM.
|
|||
### What is testability like in angular?
|
||||
|
||||
Very testable. It has an integrated dependency injection framework. See
|
||||
{@link api/angular.module.NG service} for details.
|
||||
{@link api/angular.module.ng service} for details.
|
||||
|
||||
### How can I learn more about angular?
|
||||
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ contained in the template, data model, and controller, to keep models and views
|
|||
sync. Any changes made to the model are reflected in the view; any changes that occur in the view
|
||||
are reflected in the model.
|
||||
|
||||
To learn more about Angular scopes, see the {@link api/angular.module.NG.$rootScope.Scope angular scope documentation}.
|
||||
To learn more about Angular scopes, see the {@link api/angular.module.ng.$rootScope.Scope angular scope documentation}.
|
||||
|
||||
|
||||
## Tests
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ __`app/index.html`:__
|
|||
...
|
||||
</pre>
|
||||
|
||||
We added a standard HTML `<input>` tag and used angular's {@link api/angular.module.NG.$filter.filter $filter}
|
||||
We added a standard HTML `<input>` tag and used angular's {@link api/angular.module.ng.$filter.filter $filter}
|
||||
function to process the input for the `ng:repeater`.
|
||||
|
||||
This lets a user enter search criteria and immediately see the effects of their search on the phone
|
||||
|
|
@ -59,7 +59,7 @@ the DOM to reflect the current state of the model.
|
|||
|
||||
<img src="img/tutorial/tutorial_03_final.png">
|
||||
|
||||
* Use of `$filter`. The {@link api/angular.module.NG.$filter.filter $filter} method uses the `query` value to
|
||||
* Use of `$filter`. The {@link api/angular.module.ng.$filter.filter $filter} method uses the `query` value to
|
||||
create a new array that contains only those records that match the `query`.
|
||||
|
||||
`ng:repeat` automatically updates the view in response to the changing number of phones returned
|
||||
|
|
|
|||
|
|
@ -54,9 +54,9 @@ two provided sorting options.
|
|||
|
||||
<img src="img/tutorial/tutorial_04-06_final.png">
|
||||
|
||||
* We then chained the `$filter` method with {@link api/angular.module.NG.$filter.orderBy `$orderBy`} method to
|
||||
* We then chained the `$filter` method with {@link api/angular.module.ng.$filter.orderBy `$orderBy`} method to
|
||||
further process the input into the repeater. `$orderBy` is a utility method similar to {@link
|
||||
api/angular.module.NG.$filter.filter `$filter`}, but instead of filtering an array, it reorders it.
|
||||
api/angular.module.ng.$filter.filter `$filter`}, but instead of filtering an array, it reorders it.
|
||||
|
||||
Angular creates a two way data-binding between the select element and the `orderProp` model.
|
||||
`orderProp` is then used as the input for the `$orderBy` method.
|
||||
|
|
|
|||
|
|
@ -6,8 +6,8 @@
|
|||
|
||||
|
||||
Enough of building an app with three phones in a hard-coded dataset! Let's fetch a larger dataset
|
||||
from our server using one of angular's built-in {@link api/angular.module.NG services} called {@link
|
||||
api/angular.module.NG.$xhr $xhr}. We will use angular's {@link guide/dev_guide.di dependency
|
||||
from our server using one of angular's built-in {@link api/angular.module.ng services} called {@link
|
||||
api/angular.module.ng.$xhr $xhr}. We will use angular's {@link guide/dev_guide.di dependency
|
||||
injection (DI)} to provide the service to the `PhoneListCtrl` controller.
|
||||
|
||||
|
||||
|
|
@ -42,9 +42,9 @@ Following is a sample of the file:
|
|||
|
||||
## Controller
|
||||
|
||||
We'll use angular's {@link api/angular.module.NG.$xhr $xhr} service in our controller to make an HTTP
|
||||
We'll use angular's {@link api/angular.module.ng.$xhr $xhr} service in our controller to make an HTTP
|
||||
request to your web server to fetch the data in the `app/phones/phones.json` file. `$xhr` is just
|
||||
one of several built-in {@link api/angular.module.NG angular services} that handle common operations
|
||||
one of several built-in {@link api/angular.module.ng angular services} that handle common operations
|
||||
in web apps. Angular injects these services for you where you need them.
|
||||
|
||||
Services are managed by angular's {@link guide/dev_guide.di DI subsystem}. Dependency injection
|
||||
|
|
@ -127,7 +127,7 @@ describe('PhoneCat controllers', function() {
|
|||
var scope, $browser, ctrl;
|
||||
|
||||
beforeEach(function() {
|
||||
scope = angular.module.NG.$rootScope.Scope();
|
||||
scope = angular.module.ng.$rootScope.Scope();
|
||||
$browser = scope.$service('$browser');
|
||||
|
||||
$browser.xhr.expectGET('phones/phones.json')
|
||||
|
|
@ -140,7 +140,7 @@ describe('PhoneCat controllers', function() {
|
|||
|
||||
We created the controller in the test environment, as follows:
|
||||
|
||||
* We created a root scope object by calling `angular.module.NG.$rootScope.Scope()`
|
||||
* We created a root scope object by calling `angular.module.ng.$rootScope.Scope()`
|
||||
|
||||
* We called `scope.$new(PhoneListCtrl)` to get angular to create the child scope associated with
|
||||
the `PhoneListCtrl` controller
|
||||
|
|
@ -149,7 +149,7 @@ Because our code now uses the `$xhr` service to fetch the phone list data in our
|
|||
we create the `PhoneListCtrl` child scope, we need to tell the testing harness to expect an
|
||||
incoming request from the controller. To do this we:
|
||||
|
||||
* Use the {@link api/angular.module.NG.$rootScope.Scope#$service `$service`} method to retrieve the `$browser` service,
|
||||
* Use the {@link api/angular.module.ng.$rootScope.Scope#$service `$service`} method to retrieve the `$browser` service,
|
||||
a service that angular uses to represent various browser APIs. In tests, angular automatically uses
|
||||
a mock version of this service that allows you to write tests without having to deal with these
|
||||
native APIs and the global state associated with them.
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ template into what we call a "layout template". This is a template that is commo
|
|||
our application. Other "partial templates" are then included into this layout template depending on
|
||||
the current "route" — the view that is currently displayed to the user.
|
||||
|
||||
Application routes in angular are declared via the {@link api/angular.module.NG.$route $route}
|
||||
Application routes in angular are declared via the {@link api/angular.module.ng.$route $route}
|
||||
service. This service makes it easy to wire together controllers, view templates, and the current
|
||||
URL location in the browser. Using this feature we can implement {@link
|
||||
http://en.wikipedia.org/wiki/Deep_linking deep linking}, which lets us utilize the browser's
|
||||
|
|
@ -91,7 +91,7 @@ Note the use of the `:phoneId` parameter in the second route declaration. The `$
|
|||
the route declaration — `'/phones/:phoneId'` — as a template that is matched against the current
|
||||
URL. All variables defined with the `:` notation are extracted into the `$route.current.params` map.
|
||||
|
||||
The `params` alias created in the {@link api/angular.module.NG.$route `$route.onChange`} callback
|
||||
The `params` alias created in the {@link api/angular.module.ng.$route `$route.onChange`} callback
|
||||
allows us to use the `phoneId` property of this map in the `phone-details.html` template.
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ phone in the phone list.
|
|||
Now when you click on a phone on the list, the phone details page with phone-specific information
|
||||
is displayed.
|
||||
|
||||
To implement the phone details view we will use {@link api/angular.module.NG.$xhr $xhr} to fetch our
|
||||
To implement the phone details view we will use {@link api/angular.module.ng.$xhr $xhr} to fetch our
|
||||
data, and we'll flesh out the `phone-details.html` view template.
|
||||
|
||||
The most important changes are listed below. You can see the full diff on {@link
|
||||
|
|
|
|||
|
|
@ -25,11 +25,11 @@ GitHub}:
|
|||
## Custom Filter
|
||||
|
||||
In order to create a new filter, simply register your custom filter function with the {@link
|
||||
api/angular.module.NG.$filter `angular.module.NG.$filter`} API.
|
||||
api/angular.module.ng.$filter `angular.module.ng.$filter`} API.
|
||||
|
||||
__`app/js/filters.js`:__
|
||||
<pre>
|
||||
angular.module.NG.$filter('checkmark', function(input) {
|
||||
angular.module.ng.$filter('checkmark', function(input) {
|
||||
return input ? '\u2713' : '\u2718';
|
||||
});
|
||||
</pre>
|
||||
|
|
@ -82,8 +82,8 @@ __`test/unit/filtersSpec.js`:__
|
|||
describe('checkmark filter', function() {
|
||||
|
||||
it('should convert boolean values to unicode checkmark or cross', function() {
|
||||
expect(angular.module.NG.$filter.checkmark(true)).toBe('\u2713');
|
||||
expect(angular.module.NG.$filter.checkmark(false)).toBe('\u2718');
|
||||
expect(angular.module.ng.$filter.checkmark(true)).toBe('\u2713');
|
||||
expect(angular.module.ng.$filter.checkmark(false)).toBe('\u2718');
|
||||
});
|
||||
})
|
||||
</pre>
|
||||
|
|
@ -99,7 +99,7 @@ output.
|
|||
|
||||
# Experiments
|
||||
|
||||
* Let's experiment with some of the {@link api/angular.module.NG.$filter built-in angular filters} and add the
|
||||
* Let's experiment with some of the {@link api/angular.module.ng.$filter built-in angular filters} and add the
|
||||
following bindings to `index.html`:
|
||||
* `{{ "lower cap string" | uppercase }}`
|
||||
* `{{ {foo: "bar", baz: 23} | json }}`
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ In this step, you will improve the way our app fetches data.
|
|||
The last improvement we will make to our app is to define a custom service that represents a {@link
|
||||
http://en.wikipedia.org/wiki/Representational_State_Transfer RESTful} client. Using this client we
|
||||
can make xhr requests for data in an easier way, without having to deal with the lower-level {@link
|
||||
api/angular.module.NG.$xhr $xhr} API, HTTP methods and URLs.
|
||||
api/angular.module.ng.$xhr $xhr} API, HTTP methods and URLs.
|
||||
|
||||
The most important changes are listed below. You can see the full diff on {@link
|
||||
https://github.com/angular/angular-phonecat/compare/step-10...step-11
|
||||
|
|
@ -37,30 +37,30 @@ __`app/index.html`.__
|
|||
|
||||
__`app/js/services.js`.__
|
||||
<pre>
|
||||
angular.module.NG('Phone', function($resource) {
|
||||
angular.module.ng('Phone', function($resource) {
|
||||
return $resource('phones/:phoneId.json', {}, {
|
||||
query: {method: 'GET', params: {phoneId: 'phones'}, isArray: true}
|
||||
});
|
||||
});
|
||||
</pre>
|
||||
|
||||
We used the {@link api/angular.module.NG} API to register a custom service. We passed in the name of
|
||||
We used the {@link api/angular.module.ng} API to register a custom service. We passed in the name of
|
||||
the service - 'Phone' - and a factory function. The factory function is similar to a controller's
|
||||
constructor in that both can declare dependencies via function arguments. The Phone service
|
||||
declared a dependency on the `$resource` service.
|
||||
|
||||
The {@link api/angular.module.NG.$resource `$resource`} service makes it easy to create a {@link
|
||||
The {@link api/angular.module.ng.$resource `$resource`} service makes it easy to create a {@link
|
||||
http://en.wikipedia.org/wiki/Representational_State_Transfer RESTful} client with just a few lines
|
||||
of code. This client can then be used in our application, instead of the lower-level {@link
|
||||
api/angular.module.NG.$xhr $xhr} service.
|
||||
api/angular.module.ng.$xhr $xhr} service.
|
||||
|
||||
|
||||
## Controller
|
||||
|
||||
We simplified our sub-controllers (`PhoneListCtrl` and `PhoneDetailCtrl`) by factoring out the
|
||||
lower-level {@link api/angular.module.NG.$xhr $xhr} service, replacing it with a new service called
|
||||
`Phone`. Angular's {@link api/angular.module.NG.$resource `$resource`} service is easier to use than
|
||||
{@link api/angular.module.NG.$xhr $xhr} for interacting with data sources exposed as RESTful
|
||||
lower-level {@link api/angular.module.ng.$xhr $xhr} service, replacing it with a new service called
|
||||
`Phone`. Angular's {@link api/angular.module.ng.$resource `$resource`} service is easier to use than
|
||||
{@link api/angular.module.ng.$xhr $xhr} for interacting with data sources exposed as RESTful
|
||||
resources. It is also easier now to understand what the code in our controllers is doing.
|
||||
|
||||
__`app/js/controllers.js`.__
|
||||
|
|
@ -116,7 +116,7 @@ We have modified our unit tests to verify that our new service is issuing HTTP r
|
|||
processing them as expected. The tests also check that our controllers are interacting with the
|
||||
service correctly.
|
||||
|
||||
The {@link api/angular.module.NG.$resource $resource} service augments the response object with
|
||||
The {@link api/angular.module.ng.$resource $resource} service augments the response object with
|
||||
methods for updating and deleting the resource. If we were to use the standard `toEqual` matcher,
|
||||
our tests would fail because the test values would not match the responses exactly. To solve the
|
||||
problem, we use a newly-defined `toEqualData` {@link
|
||||
|
|
@ -141,7 +141,7 @@ describe('PhoneCat controllers', function() {
|
|||
var scope, $browser, ctrl;
|
||||
|
||||
beforeEach(function() {
|
||||
scope = angular.module.NG.$rootScope.Scope();
|
||||
scope = angular.module.ng.$rootScope.Scope();
|
||||
$browser = scope.$service('$browser');
|
||||
|
||||
$browser.xhr.expectGET('phones/phones.json')
|
||||
|
|
@ -167,12 +167,12 @@ describe('PhoneCat controllers', function() {
|
|||
var scope, $browser, ctrl;
|
||||
|
||||
beforeEach(function() {
|
||||
scope = angular.module.NG.$rootScope.Scope();
|
||||
scope = angular.module.ng.$rootScope.Scope();
|
||||
$browser = scope.$service('$browser');
|
||||
});
|
||||
|
||||
beforeEach(function() {
|
||||
scope = angular.module.NG.$rootScope.Scope();
|
||||
scope = angular.module.ng.$rootScope.Scope();
|
||||
$browser = scope.$service('$browser');
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -54,6 +54,7 @@ describe('ngdoc', function() {
|
|||
|
||||
it('should parse parameters', function() {
|
||||
var doc = new Doc(
|
||||
'@name a\n' +
|
||||
'@param {*} a short\n' +
|
||||
'@param {Type} b med\n' +
|
||||
'@param {Class=} [c=2] long\nline');
|
||||
|
|
@ -66,7 +67,7 @@ describe('ngdoc', function() {
|
|||
});
|
||||
|
||||
it('should parse return', function() {
|
||||
var doc = new Doc('@returns {Type} text *bold*.');
|
||||
var doc = new Doc('@name a\n@returns {Type} text *bold*.');
|
||||
doc.parse();
|
||||
expect(doc.returns).toEqual({
|
||||
type: 'Type',
|
||||
|
|
@ -82,7 +83,7 @@ describe('ngdoc', function() {
|
|||
});
|
||||
|
||||
it('should escape <doc:source> element', function() {
|
||||
var doc = new Doc('@description before <doc:example>' +
|
||||
var doc = new Doc('@name a\n@description before <doc:example>' +
|
||||
'<doc:source>\n<>\n</doc:source></doc:example> after');
|
||||
doc.parse();
|
||||
expect(doc.description).toContain('<p>before </p><doc:example>' +
|
||||
|
|
@ -90,7 +91,7 @@ describe('ngdoc', function() {
|
|||
});
|
||||
|
||||
it('should preserve the source attribute', function() {
|
||||
var doc = new Doc('@description before <doc:example>' +
|
||||
var doc = new Doc('@name a\n@description before <doc:example>' +
|
||||
'<doc:source source="false">lala</doc:source></doc:example> after');
|
||||
doc.parse();
|
||||
expect(doc.description).toContain('<p>before </p><doc:example>' +
|
||||
|
|
@ -98,7 +99,7 @@ describe('ngdoc', function() {
|
|||
});
|
||||
|
||||
it('should preserve the jsfiddle attribute', function() {
|
||||
var doc = new Doc('@description before <doc:example>' +
|
||||
var doc = new Doc('@name a\n@description before <doc:example>' +
|
||||
'<doc:source jsfiddle="foo">lala</doc:source></doc:example> after');
|
||||
doc.parse();
|
||||
expect(doc.description).toContain('<p>before </p><doc:example>' +
|
||||
|
|
@ -106,7 +107,7 @@ describe('ngdoc', function() {
|
|||
});
|
||||
|
||||
it('should escape <doc:scenario> element', function() {
|
||||
var doc = new Doc('@description before <doc:example>' +
|
||||
var doc = new Doc('@name a\n@description before <doc:example>' +
|
||||
'<doc:scenario>\n<>\n</doc:scenario></doc:example> after');
|
||||
doc.parse();
|
||||
expect(doc.description).toContain('<p>before </p><doc:example>' +
|
||||
|
|
@ -114,7 +115,7 @@ describe('ngdoc', function() {
|
|||
});
|
||||
|
||||
it('should store all links', function() {
|
||||
var doc = new Doc('@description {@link api/angular.link}');
|
||||
var doc = new Doc('@name a\n@description {@link api/angular.link}');
|
||||
doc.parse();
|
||||
|
||||
expect(doc.links).toContain('api/angular.link');
|
||||
|
|
@ -255,17 +256,17 @@ describe('ngdoc', function() {
|
|||
|
||||
describe('merge', function() {
|
||||
it('should merge child with parent', function() {
|
||||
var parent = new Doc({id: 'angular.module.NG.abc', name: 'angular.module.NG.abc', section: 'api'});
|
||||
var methodA = new Doc({name: 'methodA', methodOf: 'angular.module.NG.abc'});
|
||||
var methodB = new Doc({name: 'methodB', methodOf: 'angular.module.NG.abc'});
|
||||
var propA = new Doc({name: 'propA', propertyOf: 'angular.module.NG.abc'});
|
||||
var propB = new Doc({name: 'propB', propertyOf: 'angular.module.NG.abc'});
|
||||
var eventA = new Doc({name: 'eventA', eventOf: 'angular.module.NG.abc'});
|
||||
var eventB = new Doc({name: 'eventB', eventOf: 'angular.module.NG.abc'});
|
||||
var parent = new Doc({id: 'angular.module.ng.abc', name: 'angular.module.ng.abc', section: 'api'});
|
||||
var methodA = new Doc({name: 'methodA', methodOf: 'angular.module.ng.abc'});
|
||||
var methodB = new Doc({name: 'methodB', methodOf: 'angular.module.ng.abc'});
|
||||
var propA = new Doc({name: 'propA', propertyOf: 'angular.module.ng.abc'});
|
||||
var propB = new Doc({name: 'propB', propertyOf: 'angular.module.ng.abc'});
|
||||
var eventA = new Doc({name: 'eventA', eventOf: 'angular.module.ng.abc'});
|
||||
var eventB = new Doc({name: 'eventB', eventOf: 'angular.module.ng.abc'});
|
||||
var docs = [methodB, methodA, eventB, eventA, propA, propB, parent]; // keep wrong order;
|
||||
ngdoc.merge(docs);
|
||||
expect(docs.length).toEqual(1);
|
||||
expect(docs[0].id).toEqual('angular.module.NG.abc');
|
||||
expect(docs[0].id).toEqual('angular.module.ng.abc');
|
||||
expect(docs[0].methods).toEqual([methodA, methodB]);
|
||||
expect(docs[0].events).toEqual([eventA, eventB]);
|
||||
expect(docs[0].properties).toEqual([propA, propB]);
|
||||
|
|
@ -305,7 +306,7 @@ describe('ngdoc', function() {
|
|||
describe('TAG', function() {
|
||||
describe('@param', function() {
|
||||
it('should parse with no default', function() {
|
||||
var doc = new Doc('@param {(number|string)} number Number \n to format.');
|
||||
var doc = new Doc('@name a\n@param {(number|string)} number Number \n to format.');
|
||||
doc.parse();
|
||||
expect(doc.param).toEqual([{
|
||||
type : '(number|string)',
|
||||
|
|
@ -316,7 +317,7 @@ describe('ngdoc', function() {
|
|||
});
|
||||
|
||||
it('should parse with default and optional', function() {
|
||||
var doc = new Doc('@param {(number|string)=} [fractionSize=2] desc');
|
||||
var doc = new Doc('@name a\n@param {(number|string)=} [fractionSize=2] desc');
|
||||
doc.parse();
|
||||
expect(doc.param).toEqual([{
|
||||
type : '(number|string)',
|
||||
|
|
@ -329,14 +330,14 @@ describe('ngdoc', function() {
|
|||
|
||||
describe('@requires', function() {
|
||||
it('should parse more @requires tag into array', function() {
|
||||
var doc = new Doc('@requires $service for \n`A`\n@requires $another for `B`');
|
||||
var doc = new Doc('@name a\n@requires $service for \n`A`\n@requires $another for `B`');
|
||||
doc.ngdoc = 'service';
|
||||
doc.parse();
|
||||
expect(doc.requires).toEqual([
|
||||
{name:'$service', text:'<p>for \n<code>A</code></p>'},
|
||||
{name:'$another', text:'<p>for <code>B</code></p>'}]);
|
||||
expect(doc.html()).toContain('<a href="api/angular.module.NG.$service">$service</a>');
|
||||
expect(doc.html()).toContain('<a href="api/angular.module.NG.$another">$another</a>');
|
||||
expect(doc.html()).toContain('<a href="api/angular.module.ng.$service">$service</a>');
|
||||
expect(doc.html()).toContain('<a href="api/angular.module.ng.$another">$another</a>');
|
||||
expect(doc.html()).toContain('<p>for \n<code>A</code></p>');
|
||||
expect(doc.html()).toContain('<p>for <code>B</code></p>');
|
||||
});
|
||||
|
|
@ -344,7 +345,7 @@ describe('ngdoc', function() {
|
|||
|
||||
describe('@property', function() {
|
||||
it('should parse @property tags into array', function() {
|
||||
var doc = new Doc("@property {type} name1 desc\n@property {type} name2 desc");
|
||||
var doc = new Doc("@name a\n@property {type} name1 desc\n@property {type} name2 desc");
|
||||
doc.parse();
|
||||
expect(doc.properties.length).toEqual(2);
|
||||
});
|
||||
|
|
@ -356,21 +357,21 @@ describe('ngdoc', function() {
|
|||
});
|
||||
|
||||
it('should parse @property with type', function() {
|
||||
var doc = new Doc("@property {string} name");
|
||||
var doc = new Doc("@name a\n@property {string} name");
|
||||
doc.parse();
|
||||
expect(doc.properties[0].name).toEqual('name');
|
||||
expect(doc.properties[0].type).toEqual('string');
|
||||
});
|
||||
|
||||
it('should parse @property with optional description', function() {
|
||||
var doc = new Doc("@property {string} name desc rip tion");
|
||||
var doc = new Doc("@name a\n@property {string} name desc rip tion");
|
||||
doc.parse();
|
||||
expect(doc.properties[0].name).toEqual('name');
|
||||
expect(doc.properties[0].description).toEqual('<p>desc rip tion</p>');
|
||||
});
|
||||
|
||||
it('should parse @property with type and description both', function() {
|
||||
var doc = new Doc("@property {bool} name desc rip tion");
|
||||
var doc = new Doc("@name a\n@property {bool} name desc rip tion");
|
||||
doc.parse();
|
||||
expect(doc.properties[0].name).toEqual('name');
|
||||
expect(doc.properties[0].type).toEqual('bool');
|
||||
|
|
@ -386,19 +387,19 @@ describe('ngdoc', function() {
|
|||
});
|
||||
|
||||
it('should parse @returns with type and description', function() {
|
||||
var doc = new Doc("@returns {string} descrip tion");
|
||||
var doc = new Doc("@name a\n@returns {string} descrip tion");
|
||||
doc.parse();
|
||||
expect(doc.returns).toEqual({type: 'string', description: '<p>descrip tion</p>'});
|
||||
});
|
||||
|
||||
it('should transform description of @returns with markdown', function() {
|
||||
var doc = new Doc("@returns {string} descrip *tion*");
|
||||
var doc = new Doc("@name a\n@returns {string} descrip *tion*");
|
||||
doc.parse();
|
||||
expect(doc.returns).toEqual({type: 'string', description: '<p>descrip <em>tion</em></p>'});
|
||||
});
|
||||
|
||||
it('should support multiline content', function() {
|
||||
var doc = new Doc("@returns {string} description\n new line\n another line");
|
||||
var doc = new Doc("@name a\n@returns {string} description\n new line\n another line");
|
||||
doc.parse();
|
||||
expect(doc.returns).
|
||||
toEqual({type: 'string', description: '<p>description\nnew line\nanother line</p>'});
|
||||
|
|
@ -407,14 +408,14 @@ describe('ngdoc', function() {
|
|||
|
||||
describe('@description', function() {
|
||||
it('should support pre blocks', function() {
|
||||
var doc = new Doc("@description <pre><b>abc</b></pre>");
|
||||
var doc = new Doc("@name a\n@description <pre><b>abc</b></pre>");
|
||||
doc.parse();
|
||||
expect(doc.description).
|
||||
toBe('<div ng:non-bindable><pre class="brush: js; html-script: true;"><b>abc</b></pre></div>');
|
||||
});
|
||||
|
||||
it('should support multiple pre blocks', function() {
|
||||
var doc = new Doc("@description foo \n<pre>abc</pre>\n#bah\nfoo \n<pre>cba</pre>");
|
||||
var doc = new Doc("@name a\n@description foo \n<pre>abc</pre>\n#bah\nfoo \n<pre>cba</pre>");
|
||||
doc.parse();
|
||||
expect(doc.description).
|
||||
toBe('<p>foo </p>' +
|
||||
|
|
@ -426,7 +427,7 @@ describe('ngdoc', function() {
|
|||
});
|
||||
|
||||
it('should support nested @link annotations with or without description', function() {
|
||||
var doc = new Doc("@description " +
|
||||
var doc = new Doc("@name a\n@description " +
|
||||
'foo {@link angular.foo}\n\n da {@link angular.foo bar foo bar } \n\n' +
|
||||
'dad{@link angular.foo}\n\n' +
|
||||
'external{@link http://angularjs.org}\n\n' +
|
||||
|
|
@ -451,7 +452,7 @@ describe('ngdoc', function() {
|
|||
});
|
||||
|
||||
it('should support line breaks in @link', function() {
|
||||
var doc = new Doc("@description " +
|
||||
var doc = new Doc("@name a\n@description " +
|
||||
'{@link\napi/angular.foo\na\nb}');
|
||||
doc.parse();
|
||||
expect(doc.description).
|
||||
|
|
@ -462,13 +463,13 @@ describe('ngdoc', function() {
|
|||
|
||||
describe('@example', function() {
|
||||
it('should not remove {{}}', function() {
|
||||
var doc = new Doc('@example text {{ abc }}');
|
||||
var doc = new Doc('@name a\n@example text {{ abc }}');
|
||||
doc.parse();
|
||||
expect(doc.example).toEqual('<p>text {{ abc }}</p>');
|
||||
});
|
||||
|
||||
it('should support doc:example', function() {
|
||||
var doc = new Doc('@ngdoc overview\n@example \n' +
|
||||
var doc = new Doc('@name a\n@ngdoc overview\n@example \n' +
|
||||
'<doc:example>\n' +
|
||||
' <doc:source><escapeme></doc:source>\n' +
|
||||
' <doc:scenario><scenario></doc:scenario>\n' +
|
||||
|
|
@ -482,7 +483,7 @@ describe('ngdoc', function() {
|
|||
|
||||
describe('@deprecated', function() {
|
||||
it('should parse @deprecated', function() {
|
||||
var doc = new Doc('@deprecated Replaced with foo.');
|
||||
var doc = new Doc('@name a\n@deprecated Replaced with foo.');
|
||||
doc.parse();
|
||||
expect(doc.deprecated).toBe('Replaced with foo.');
|
||||
});
|
||||
|
|
@ -490,7 +491,7 @@ describe('ngdoc', function() {
|
|||
|
||||
describe('@this', function() {
|
||||
it('should render @this', function() {
|
||||
var doc = new Doc('@this I am self.');
|
||||
var doc = new Doc('@name a\n@this I am self.');
|
||||
doc.ngdoc = 'filter';
|
||||
doc.parse();
|
||||
expect(doc.html()).toContain('<h3>Method\'s <code>this</code></h3>\n' +
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@ Doc.prototype = {
|
|||
|
||||
return '<a href="' + absUrl + '">' +
|
||||
(isAngular ? '<code>' : '') +
|
||||
(title || url.replace(/^#/g, '')).replace(/\n/g, ' ') +
|
||||
(title || url).replace(/^#/g, '').replace(/\n/g, ' ') +
|
||||
(isAngular ? '</code>' : '') +
|
||||
'</a>';
|
||||
});
|
||||
|
|
@ -175,7 +175,6 @@ Doc.prototype = {
|
|||
}
|
||||
});
|
||||
flush();
|
||||
this.name = this.name || '';
|
||||
this.shortName = this.name.split(this.name.match(/#/) ? /#/ : /\./ ).pop();
|
||||
this.id = this.id || // if we have an id just use it
|
||||
(((this.file||'').match(/.*\/([^\/]*)\.ngdoc/)||{})[1]) || // try to extract it from file name
|
||||
|
|
@ -252,7 +251,7 @@ Doc.prototype = {
|
|||
}
|
||||
dom.h('Dependencies', self.requires, function(require){
|
||||
dom.tag('code', function() {
|
||||
dom.tag('a', {href: 'api/angular.module.NG.' + require.name}, require.name);
|
||||
dom.tag('a', {href: 'api/angular.module.ng.' + require.name}, require.name);
|
||||
});
|
||||
dom.html(require.text);
|
||||
});
|
||||
|
|
@ -620,12 +619,12 @@ var KEYWORD_PRIORITY = {
|
|||
'.index': 1,
|
||||
'.guide': 2,
|
||||
'.angular': 7,
|
||||
'.angular.module.NG.$filter': 7,
|
||||
'.angular.module.ng.$filter': 7,
|
||||
'.angular.Object': 7,
|
||||
'.angular.directive': 7,
|
||||
'.angular.module.NG.$filter': 7,
|
||||
'.angular.module.NG.$rootScope.Scope': 7,
|
||||
'.angular.module.NG': 7,
|
||||
'.angular.module.ng.$filter': 7,
|
||||
'.angular.module.ng.$rootScope.Scope': 7,
|
||||
'.angular.module.ng': 7,
|
||||
'.angular.inputType': 7,
|
||||
'.angular.widget': 7,
|
||||
'.angular.mock': 8,
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ function collect() {
|
|||
return done;
|
||||
});
|
||||
|
||||
//collect all NG Docs in Content Folder
|
||||
//collect all ng Docs in Content Folder
|
||||
var path2 = 'docs/content';
|
||||
var promiseB = Q.when(qfs.listTree(path2), function(files){
|
||||
var done2;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
angular.module.NG('myApplication', function($resource){
|
||||
angular.module.ng('myApplication', function($resource){
|
||||
this.Activity = $resource(
|
||||
'https://www.googleapis.com/buzz/v1/activities/:userId/:visibility/:activityId/:comments',
|
||||
{alt:'json', callback:'JSON_CALLBACK'},
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ describe('example.personalLog.LogCtrl', function() {
|
|||
var logCtrl;
|
||||
|
||||
function createNotesCtrl() {
|
||||
var injector = angular.injector('NG', 'NG_MOCK');
|
||||
var injector = angular.injector('ng', 'ngMock');
|
||||
var scope = injector('$rootScope');
|
||||
scope.$cookies = injector('$cookies');
|
||||
return scope.$new(example.personalLog.LogCtrl);
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
<title>angular dev sandbox</title>
|
||||
<script src="../src/angular-bootstrap.js" ng:autobind></script>
|
||||
<script>
|
||||
angular.module.NG('routeConfig', function($route) {
|
||||
angular.module.ng('routeConfig', function($route) {
|
||||
$route.when('/view1', {controller: MyCtrl, template: 'view1.html'});
|
||||
$route.when('/view2', {controller: MyCtrl, template: 'view2.html'});
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
<script type="text/javascript" src="../src/angular-bootstrap.js" ng:autobind></script>
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
angular.module.NG('myService', function($resource){
|
||||
angular.module.ng('myService', function($resource){
|
||||
this.myData = $resource('resource_json_date.json');
|
||||
}, {$inject:['$resource'], $creation:'eager'});
|
||||
|
||||
|
|
|
|||
|
|
@ -99,9 +99,9 @@ var $$scope = '$scope',
|
|||
angularDirective = extensionMap(angular, 'directive', lowercase),
|
||||
/** @name angular.widget */
|
||||
angularWidget = extensionMap(angular, 'widget', shivForIE),
|
||||
/** @name angular.module.NG */
|
||||
/** @name angular.module.ng */
|
||||
angularInputType = extensionMap(angular, 'inputType', lowercase),
|
||||
/** @name angular.module.NG */
|
||||
/** @name angular.module.ng */
|
||||
angularCallbacks = extensionMap(angular, 'callbacks'),
|
||||
nodeName_,
|
||||
uid = ['0', '0', '0'],
|
||||
|
|
@ -571,7 +571,7 @@ function isLeafNode (node) {
|
|||
* * If `source` is not an object or array, `source` is returned.
|
||||
*
|
||||
* Note: this function is used to augment the Object type in Angular expressions. See
|
||||
* {@link angular.module.NG.$filter} for more information about Angular arrays.
|
||||
* {@link angular.module.ng.$filter} for more information about Angular arrays.
|
||||
*
|
||||
* @param {*} source The source that will be used to make a copy.
|
||||
* Can be any type, including primitives, `null`, and `undefined`.
|
||||
|
|
@ -629,7 +629,7 @@ function copy(source, destination){
|
|||
* that begin with `$` are ignored.
|
||||
*
|
||||
* Note: This function is used to augment the Object type in Angular expressions. See
|
||||
* {@link angular.module.NG.$filter} for more information about Angular arrays.
|
||||
* {@link angular.module.ng.$filter} for more information about Angular arrays.
|
||||
*
|
||||
* @param {*} o1 Object or value to compare.
|
||||
* @param {*} o2 Object or value to compare.
|
||||
|
|
@ -944,7 +944,7 @@ function publishExternalAPI(angular){
|
|||
'uppercase': uppercase
|
||||
});
|
||||
|
||||
angularModule.NG = ngModule;
|
||||
angularModule.ng = ngModule;
|
||||
}
|
||||
|
||||
ngModule.$inject = ['$provide', '$injector'];
|
||||
|
|
|
|||
|
|
@ -11,14 +11,14 @@
|
|||
*
|
||||
|
||||
* @param {<string, function()>} modules... A list of module functions or their aliases. See
|
||||
* {@link angular.module}. The `NG` module must be explicitly added.
|
||||
* {@link angular.module}. The `ng` module must be explicitly added.
|
||||
* @returns {function()} Injector function. See {@link angular.module.AUTO.$injector $injector}.
|
||||
*
|
||||
* @example
|
||||
* Typical usage
|
||||
* <pre>
|
||||
* // create an injector
|
||||
* var $injector = angular.injector('NG');
|
||||
* var $injector = angular.injector('ng');
|
||||
*
|
||||
* // use the injector to kick of your application
|
||||
* // use the type inference to auto inject arguments, or use implicit injection
|
||||
|
|
|
|||
148
src/angular-mocks.js
vendored
148
src/angular-mocks.js
vendored
|
|
@ -11,44 +11,44 @@ angular.module = angular.module || {};
|
|||
|
||||
/**
|
||||
* @ngdoc overview
|
||||
* @name angular.module.NG_MOCK
|
||||
* @name angular.module.ngMock
|
||||
* @description
|
||||
*
|
||||
* The `NG_MOCK` is an angular module which is used with `NG` module and adds unit-test configuration as well as useful
|
||||
* The `ngMock` is an angular module which is used with `ng` module and adds unit-test configuration as well as useful
|
||||
* mocks to the {@link angular.module.AUTO.$injector $injector}.
|
||||
*/
|
||||
angular.module.NG_MOCK = function($provide){
|
||||
$provide.service('$browser', angular.module.NG_MOCK.$BrowserProvider);
|
||||
$provide.service('$exceptionHandler', angular.module.NG_MOCK.$ExceptionHandlerProvider);
|
||||
$provide.service('$log', angular.module.NG_MOCK.$LogProvider);
|
||||
angular.module.ngMock = function($provide){
|
||||
$provide.service('$browser', angular.module.ngMock.$BrowserProvider);
|
||||
$provide.service('$exceptionHandler', angular.module.ngMock.$ExceptionHandlerProvider);
|
||||
$provide.service('$log', angular.module.ngMock.$LogProvider);
|
||||
};
|
||||
angular.module.NG_MOCK.$inject = ['$provide'];
|
||||
angular.module.ngMock.$inject = ['$provide'];
|
||||
|
||||
/**
|
||||
* @ngdoc object
|
||||
* @name angular.module.NG_MOCK.$browser
|
||||
* @name angular.module.ngMock.$browser
|
||||
*
|
||||
* @description
|
||||
* This service is a mock implementation of {@link angular.module.NG.$browser}. It provides fake
|
||||
* This service is a mock implementation of {@link angular.module.ng.$browser}. It provides fake
|
||||
* implementation for commonly used browser apis that are hard to test, e.g. setTimeout, xhr,
|
||||
* cookies, etc...
|
||||
*
|
||||
* The api of this service is the same as that of the real {@link angular.module.NG.$browser $browser}, except
|
||||
* The api of this service is the same as that of the real {@link angular.module.ng.$browser $browser}, except
|
||||
* that there are several helper methods available which can be used in tests.
|
||||
*
|
||||
* The following apis can be used in tests:
|
||||
*
|
||||
* - {@link #xhr} — enables testing of code that uses
|
||||
* the {@link angular.module.NG.$xhr $xhr service} to make XmlHttpRequests.
|
||||
* the {@link angular.module.ng.$xhr $xhr service} to make XmlHttpRequests.
|
||||
* - $browser.defer — enables testing of code that uses
|
||||
* {@link angular.module.NG.$defer $defer} for executing functions via the `setTimeout` api.
|
||||
* {@link angular.module.ng.$defer $defer} for executing functions via the `setTimeout` api.
|
||||
*/
|
||||
angular.module.NG_MOCK.$BrowserProvider = function(){
|
||||
angular.module.ngMock.$BrowserProvider = function(){
|
||||
this.$get = function(){
|
||||
return new angular.module.NG_MOCK.$Browser();
|
||||
return new angular.module.ngMock.$Browser();
|
||||
};
|
||||
};
|
||||
angular.module.NG_MOCK.$Browser = function() {
|
||||
angular.module.ngMock.$Browser = function() {
|
||||
var self = this,
|
||||
expectations = {},
|
||||
requests = [];
|
||||
|
|
@ -77,8 +77,8 @@ angular.module.NG_MOCK.$Browser = function() {
|
|||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name angular.module.NG_MOCK.$browser#xhr
|
||||
* @methodOf angular.module.NG_MOCK.$browser
|
||||
* @name angular.module.ngMock.$browser#xhr
|
||||
* @methodOf angular.module.ngMock.$browser
|
||||
*
|
||||
* @description
|
||||
* Generic method for training browser to expect a request in a test and respond to it.
|
||||
|
|
@ -140,8 +140,8 @@ angular.module.NG_MOCK.$Browser = function() {
|
|||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name angular.module.NG_MOCK.$browser#xhr.expectGET
|
||||
* @methodOf angular.module.NG_MOCK.$browser
|
||||
* @name angular.module.ngMock.$browser#xhr.expectGET
|
||||
* @methodOf angular.module.ngMock.$browser
|
||||
*
|
||||
* @description
|
||||
* Trains browser to expect a `GET` request and respond to it.
|
||||
|
|
@ -149,14 +149,14 @@ angular.module.NG_MOCK.$Browser = function() {
|
|||
* @param {string} url Url path for which a request is expected.
|
||||
* @returns {object} Response configuration object. You can call its `respond()` method to
|
||||
* configure what should the browser mock return when the response is
|
||||
* {@link angular.module.NG_MOCK.$browser#xhr.flush flushed}.
|
||||
* {@link angular.module.ngMock.$browser#xhr.flush flushed}.
|
||||
*/
|
||||
self.xhr.expectGET = angular.bind(self, self.xhr.expect, 'GET');
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name angular.module.NG_MOCK.$browser#xhr.expectPOST
|
||||
* @methodOf angular.module.NG_MOCK.$browser
|
||||
* @name angular.module.ngMock.$browser#xhr.expectPOST
|
||||
* @methodOf angular.module.ngMock.$browser
|
||||
*
|
||||
* @description
|
||||
* Trains browser to expect a `POST` request and respond to it.
|
||||
|
|
@ -164,14 +164,14 @@ angular.module.NG_MOCK.$Browser = function() {
|
|||
* @param {string} url Url path for which a request is expected.
|
||||
* @returns {object} Response configuration object. You can call its `respond()` method to
|
||||
* configure what should the browser mock return when the response is
|
||||
* {@link angular.module.NG_MOCK.$browser#xhr.flush flushed}.
|
||||
* {@link angular.module.ngMock.$browser#xhr.flush flushed}.
|
||||
*/
|
||||
self.xhr.expectPOST = angular.bind(self, self.xhr.expect, 'POST');
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name angular.module.NG_MOCK.$browser#xhr.expectDELETE
|
||||
* @methodOf angular.module.NG_MOCK.$browser
|
||||
* @name angular.module.ngMock.$browser#xhr.expectDELETE
|
||||
* @methodOf angular.module.ngMock.$browser
|
||||
*
|
||||
* @description
|
||||
* Trains browser to expect a `DELETE` request and respond to it.
|
||||
|
|
@ -179,14 +179,14 @@ angular.module.NG_MOCK.$Browser = function() {
|
|||
* @param {string} url Url path for which a request is expected.
|
||||
* @returns {object} Response configuration object. You can call its `respond()` method to
|
||||
* configure what should the browser mock return when the response is
|
||||
* {@link angular.module.NG_MOCK.$browser#xhr.flush flushed}.
|
||||
* {@link angular.module.ngMock.$browser#xhr.flush flushed}.
|
||||
*/
|
||||
self.xhr.expectDELETE = angular.bind(self, self.xhr.expect, 'DELETE');
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name angular.module.NG_MOCK.$browser#xhr.expectPUT
|
||||
* @methodOf angular.module.NG_MOCK.$browser
|
||||
* @name angular.module.ngMock.$browser#xhr.expectPUT
|
||||
* @methodOf angular.module.ngMock.$browser
|
||||
*
|
||||
* @description
|
||||
* Trains browser to expect a `PUT` request and respond to it.
|
||||
|
|
@ -194,14 +194,14 @@ angular.module.NG_MOCK.$Browser = function() {
|
|||
* @param {string} url Url path for which a request is expected.
|
||||
* @returns {object} Response configuration object. You can call its `respond()` method to
|
||||
* configure what should the browser mock return when the response is
|
||||
* {@link angular.module.NG_MOCK.$browser#xhr.flush flushed}.
|
||||
* {@link angular.module.ngMock.$browser#xhr.flush flushed}.
|
||||
*/
|
||||
self.xhr.expectPUT = angular.bind(self, self.xhr.expect, 'PUT');
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name angular.module.NG_MOCK.$browser#xhr.expectJSON
|
||||
* @methodOf angular.module.NG_MOCK.$browser
|
||||
* @name angular.module.ngMock.$browser#xhr.expectJSON
|
||||
* @methodOf angular.module.ngMock.$browser
|
||||
*
|
||||
* @description
|
||||
* Trains browser to expect a `JSON` request and respond to it.
|
||||
|
|
@ -209,14 +209,14 @@ angular.module.NG_MOCK.$Browser = function() {
|
|||
* @param {string} url Url path for which a request is expected.
|
||||
* @returns {object} Response configuration object. You can call its `respond()` method to
|
||||
* configure what should the browser mock return when the response is
|
||||
* {@link angular.module.NG_MOCK.$browser#xhr.flush flushed}.
|
||||
* {@link angular.module.ngMock.$browser#xhr.flush flushed}.
|
||||
*/
|
||||
self.xhr.expectJSON = angular.bind(self, self.xhr.expect, 'JSON');
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name angular.module.NG_MOCK.$browser#xhr.flush
|
||||
* @methodOf angular.module.NG_MOCK.$browser
|
||||
* @name angular.module.ngMock.$browser#xhr.flush
|
||||
* @methodOf angular.module.ngMock.$browser
|
||||
*
|
||||
* @description
|
||||
* Flushes all pending requests and executes xhr callbacks with the trained response as the
|
||||
|
|
@ -266,8 +266,8 @@ angular.module.NG_MOCK.$Browser = function() {
|
|||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name angular.module.NG_MOCK.$browser#defer.flush
|
||||
* @methodOf angular.module.NG_MOCK.$browser
|
||||
* @name angular.module.ngMock.$browser#defer.flush
|
||||
* @methodOf angular.module.ngMock.$browser
|
||||
*
|
||||
* @description
|
||||
* Flushes all pending requests and executes the defer callbacks.
|
||||
|
|
@ -289,8 +289,8 @@ angular.module.NG_MOCK.$Browser = function() {
|
|||
};
|
||||
/**
|
||||
* @ngdoc property
|
||||
* @name angular.module.NG_MOCK.$browser#defer.now
|
||||
* @propertyOf angular.module.NG_MOCK.$browser
|
||||
* @name angular.module.ngMock.$browser#defer.now
|
||||
* @propertyOf angular.module.ngMock.$browser
|
||||
*
|
||||
* @description
|
||||
* Current milliseconds mock time.
|
||||
|
|
@ -301,11 +301,11 @@ angular.module.NG_MOCK.$Browser = function() {
|
|||
return this.$$baseHref;
|
||||
};
|
||||
}
|
||||
angular.module.NG_MOCK.$Browser.prototype = {
|
||||
angular.module.ngMock.$Browser.prototype = {
|
||||
|
||||
/**
|
||||
* @name angular.module.NG_MOCK.$browser#poll
|
||||
* @methodOf angular.module.NG_MOCK.$browser
|
||||
* @name angular.module.ngMock.$browser#poll
|
||||
* @methodOf angular.module.ngMock.$browser
|
||||
*
|
||||
* @description
|
||||
* run all fns in pollFns
|
||||
|
|
@ -357,30 +357,30 @@ angular.module.NG_MOCK.$Browser.prototype = {
|
|||
|
||||
/**
|
||||
* @ngdoc object
|
||||
* @name angular.module.NG_MOCK.$exceptionHandlerProvider
|
||||
* @name angular.module.ngMock.$exceptionHandlerProvider
|
||||
*
|
||||
* @description
|
||||
* Configures the mock implementation of {@link angular.module.NG.$exceptionHandler} to rethrow or to log errors passed
|
||||
* Configures the mock implementation of {@link angular.module.ng.$exceptionHandler} to rethrow or to log errors passed
|
||||
* into the `$exceptionHandler`.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ngdoc object
|
||||
* @name angular.module.NG_MOCK.$exceptionHandler
|
||||
* @name angular.module.ngMock.$exceptionHandler
|
||||
*
|
||||
* @description
|
||||
* Mock implementation of {@link angular.module.NG.$exceptionHandler} that rethrows or logs errors passed
|
||||
* into it. See {@link angular.module.NG_MOCK.$exceptionHandlerProvider $exceptionHandlerProvider} for configuration
|
||||
* Mock implementation of {@link angular.module.ng.$exceptionHandler} that rethrows or logs errors passed
|
||||
* into it. See {@link angular.module.ngMock.$exceptionHandlerProvider $exceptionHandlerProvider} for configuration
|
||||
* information.
|
||||
*/
|
||||
|
||||
angular.module.NG_MOCK.$ExceptionHandlerProvider = function(){
|
||||
angular.module.ngMock.$ExceptionHandlerProvider = function(){
|
||||
var handler;
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name angular.module.NG_MOCK.$exceptionHandlerProvider#mode
|
||||
* @methodOf angular.module.NG_MOCK.$exceptionHandlerProvider
|
||||
* @name angular.module.ngMock.$exceptionHandlerProvider#mode
|
||||
* @methodOf angular.module.ngMock.$exceptionHandlerProvider
|
||||
*
|
||||
* @description
|
||||
* Sets the logging mode.
|
||||
|
|
@ -392,8 +392,8 @@ angular.module.NG_MOCK.$ExceptionHandlerProvider = function(){
|
|||
* make these tests fail.
|
||||
* - `log`: Sometimes it is desirable to test that an error is throw, for this case the `log` mode stores the
|
||||
* error and allows later assertion of it.
|
||||
* See {@link angular.module.NG_MOCK.$log#assertEmpty assertEmpty()} and
|
||||
* {@link angular.module.NG_MOCK.$log#reset reset()}
|
||||
* See {@link angular.module.ngMock.$log#assertEmpty assertEmpty()} and
|
||||
* {@link angular.module.ngMock.$log#reset reset()}
|
||||
*/
|
||||
this.mode = function(mode){
|
||||
switch(mode) {
|
||||
|
|
@ -424,15 +424,15 @@ angular.module.NG_MOCK.$ExceptionHandlerProvider = function(){
|
|||
|
||||
/**
|
||||
* @ngdoc service
|
||||
* @name angular.module.NG_MOCK.$log
|
||||
* @name angular.module.ngMock.$log
|
||||
*
|
||||
* @description
|
||||
* Mock implementation of {@link angular.module.NG.$log} that gathers all logged messages in arrays
|
||||
* Mock implementation of {@link angular.module.ng.$log} that gathers all logged messages in arrays
|
||||
* (one array per logging level). These arrays are exposed as `logs` property of each of the
|
||||
* level-specific log function, e.g. for level `error` the array is exposed as `$log.error.logs`.
|
||||
*
|
||||
*/
|
||||
angular.module.NG_MOCK.$LogProvider = function(){
|
||||
angular.module.ngMock.$LogProvider = function(){
|
||||
|
||||
function concat(array1, array2, index) {
|
||||
return array1.concat(Array.prototype.slice.call(array2, index));
|
||||
|
|
@ -449,8 +449,8 @@ angular.module.NG_MOCK.$LogProvider = function(){
|
|||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name angular.module.NG_MOCK.$log#reset
|
||||
* @methodOf angular.module.NG_MOCK.$log
|
||||
* @name angular.module.ngMock.$log#reset
|
||||
* @methodOf angular.module.ngMock.$log
|
||||
*
|
||||
* @description
|
||||
* Reset all of the logging arrays to empty.
|
||||
|
|
@ -458,8 +458,8 @@ angular.module.NG_MOCK.$LogProvider = function(){
|
|||
$log.reset = function (){
|
||||
/**
|
||||
* @ngdoc property
|
||||
* @name angular.module.NG_MOCK.$log#log.logs
|
||||
* @propertyOf angular.module.NG_MOCK.$log
|
||||
* @name angular.module.ngMock.$log#log.logs
|
||||
* @propertyOf angular.module.ngMock.$log
|
||||
*
|
||||
* @description
|
||||
* Array of logged messages.
|
||||
|
|
@ -467,8 +467,8 @@ angular.module.NG_MOCK.$LogProvider = function(){
|
|||
$log.log.logs = [];
|
||||
/**
|
||||
* @ngdoc property
|
||||
* @name angular.module.NG_MOCK.$log#warn.logs
|
||||
* @propertyOf angular.module.NG_MOCK.$log
|
||||
* @name angular.module.ngMock.$log#warn.logs
|
||||
* @propertyOf angular.module.ngMock.$log
|
||||
*
|
||||
* @description
|
||||
* Array of logged messages.
|
||||
|
|
@ -476,8 +476,8 @@ angular.module.NG_MOCK.$LogProvider = function(){
|
|||
$log.warn.logs = [];
|
||||
/**
|
||||
* @ngdoc property
|
||||
* @name angular.module.NG_MOCK.$log#info.logs
|
||||
* @propertyOf angular.module.NG_MOCK.$log
|
||||
* @name angular.module.ngMock.$log#info.logs
|
||||
* @propertyOf angular.module.ngMock.$log
|
||||
*
|
||||
* @description
|
||||
* Array of logged messages.
|
||||
|
|
@ -485,8 +485,8 @@ angular.module.NG_MOCK.$LogProvider = function(){
|
|||
$log.info.logs = [];
|
||||
/**
|
||||
* @ngdoc property
|
||||
* @name angular.module.NG_MOCK.$log#error.logs
|
||||
* @propertyOf angular.module.NG_MOCK.$log
|
||||
* @name angular.module.ngMock.$log#error.logs
|
||||
* @propertyOf angular.module.ngMock.$log
|
||||
*
|
||||
* @description
|
||||
* Array of logged messages.
|
||||
|
|
@ -496,8 +496,8 @@ angular.module.NG_MOCK.$LogProvider = function(){
|
|||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name angular.module.NG_MOCK.$log#assertEmpty
|
||||
* @methodOf angular.module.NG_MOCK.$log
|
||||
* @name angular.module.ngMock.$log#assertEmpty
|
||||
* @methodOf angular.module.ngMock.$log
|
||||
*
|
||||
* @description
|
||||
* Assert that the all of the logging methods have no logged messages. If messages present, an exception is thrown.
|
||||
|
|
@ -527,7 +527,7 @@ angular.module.NG_MOCK.$LogProvider = function(){
|
|||
|
||||
/**
|
||||
* @ngdoc object
|
||||
* @name angular.module.NG_MOCK.TzDate
|
||||
* @name angular.module.ngMock.TzDate
|
||||
* @description
|
||||
*
|
||||
* *NOTE*: this is not an injectable instance, just a globally available mock class of `Date`.
|
||||
|
|
@ -561,7 +561,7 @@ angular.module.NG_MOCK.$LogProvider = function(){
|
|||
* </pre>
|
||||
*
|
||||
*/
|
||||
angular.module.NG_MOCK.TzDate = function (offset, timestamp) {
|
||||
angular.module.ngMock.TzDate = function (offset, timestamp) {
|
||||
var self = new Date(0);
|
||||
if (angular.isString(timestamp)) {
|
||||
var tsStr = timestamp;
|
||||
|
|
@ -664,12 +664,12 @@ angular.module.NG_MOCK.TzDate = function (offset, timestamp) {
|
|||
}
|
||||
|
||||
//make "tzDateInstance instanceof Date" return true
|
||||
angular.module.NG_MOCK.TzDate.prototype = Date.prototype;
|
||||
angular.module.ngMock.TzDate.prototype = Date.prototype;
|
||||
|
||||
|
||||
/**
|
||||
* @ngdoc function
|
||||
* @name angular.module.NG_MOCK.debug
|
||||
* @name angular.module.ngMock.debug
|
||||
* @description
|
||||
*
|
||||
* *NOTE*: this is not an injectable instance, just a globally available function.
|
||||
|
|
@ -681,7 +681,7 @@ angular.module.NG_MOCK.TzDate.prototype = Date.prototype;
|
|||
* @param {*} object - any object to turn into string.
|
||||
* @return a serialized string of the argument
|
||||
*/
|
||||
angular.module.NG_MOCK.dump = function(object){
|
||||
angular.module.ngMock.dump = function(object){
|
||||
var out;
|
||||
if (angular.isElement(object)) {
|
||||
object = angular.element(object);
|
||||
|
|
@ -726,7 +726,7 @@ window.jstestdriver && (function(window){
|
|||
window.dump = function() {
|
||||
var args = [];
|
||||
angular.forEach(arguments, function(arg){
|
||||
args.push(angular.module.NG_MOCK.dump(arg));
|
||||
args.push(angular.module.ngMock.dump(arg));
|
||||
});
|
||||
jstestdriver.console.log.apply(jstestdriver.console, args);
|
||||
};
|
||||
|
|
@ -735,7 +735,7 @@ window.jstestdriver && (function(window){
|
|||
|
||||
/**
|
||||
* @ngdoc function
|
||||
* @name angular.module.NG_MOCK.inject
|
||||
* @name angular.module.ngMock.inject
|
||||
* @description
|
||||
*
|
||||
* *NOTE*: this is not an injectable instance, just a globally available function on window.
|
||||
|
|
@ -783,7 +783,7 @@ window.jasmine && (function(window){
|
|||
return function(){
|
||||
var injector = this.$injector;
|
||||
if (!injector) {
|
||||
injector = this.$injector = angular.injector('NG', 'NG_MOCK');
|
||||
injector = this.$injector = angular.injector('ng', 'ngMock');
|
||||
}
|
||||
for(var i = 0, ii = blockFns.length; i < ii; i++) {
|
||||
injector.invoke(this, blockFns[i]);
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ angularDirective("ng:init", function(expression){
|
|||
* * Controller — The `ng:controller` directive specifies a Controller class; the class has
|
||||
* methods that typically express the business logic behind the application.
|
||||
*
|
||||
* Note that an alternative way to define controllers is via the `{@link angular.module.NG.$route}`
|
||||
* Note that an alternative way to define controllers is via the `{@link angular.module.ng.$route}`
|
||||
* service.
|
||||
*
|
||||
* @element ANY
|
||||
|
|
@ -138,7 +138,7 @@ angularDirective("ng:init", function(expression){
|
|||
this.contacts.push({type:'email', value:'yourname@example.org'});
|
||||
},
|
||||
removeContact: function(contactToRemove) {
|
||||
angular.module.NG.$filter.remove(this.contacts, contactToRemove);
|
||||
angular.module.ng.$filter.remove(this.contacts, contactToRemove);
|
||||
},
|
||||
clearContact: function(contact) {
|
||||
contact.type = 'phone';
|
||||
|
|
|
|||
|
|
@ -163,7 +163,7 @@ angular.scenario.Runner.prototype.createSpecRunner_ = function(scope) {
|
|||
*/
|
||||
angular.scenario.Runner.prototype.run = function(application) {
|
||||
var self = this;
|
||||
var $root = angular.injector('NG')('$rootScope');
|
||||
var $root = angular.injector('ng')('$rootScope');
|
||||
angular.extend($root, this);
|
||||
angular.forEach(angular.scenario.Runner.prototype, function(fn, name) {
|
||||
$root[name] = angular.bind(self, fn);
|
||||
|
|
|
|||
|
|
@ -38,10 +38,10 @@ angular.scenario.dsl('sleep', function() {
|
|||
* browser().window.path() window.location.pathname
|
||||
* browser().window.search() window.location.search
|
||||
* browser().window.hash() window.location.hash without # prefix
|
||||
* browser().location().url() see angular.module.NG.$location#url
|
||||
* browser().location().path() see angular.module.NG.$location#path
|
||||
* browser().location().search() see angular.module.NG.$location#search
|
||||
* browser().location().hash() see angular.module.NG.$location#hash
|
||||
* browser().location().url() see angular.module.ng.$location#url
|
||||
* browser().location().path() see angular.module.ng.$location#path
|
||||
* browser().location().search() see angular.module.ng.$location#search
|
||||
* browser().location().hash() see angular.module.ng.$location#hash
|
||||
*/
|
||||
angular.scenario.dsl('browser', function() {
|
||||
var chain = {};
|
||||
|
|
@ -103,25 +103,25 @@ angular.scenario.dsl('browser', function() {
|
|||
|
||||
api.url = function() {
|
||||
return this.addFutureAction('$location.url()', function($window, $document, done) {
|
||||
done(null, $window.angular.injector('NG')('$location').url());
|
||||
done(null, $window.angular.injector('ng')('$location').url());
|
||||
});
|
||||
};
|
||||
|
||||
api.path = function() {
|
||||
return this.addFutureAction('$location.path()', function($window, $document, done) {
|
||||
done(null, $window.angular.injector('NG')('$location').path());
|
||||
done(null, $window.angular.injector('ng')('$location').path());
|
||||
});
|
||||
};
|
||||
|
||||
api.search = function() {
|
||||
return this.addFutureAction('$location.search()', function($window, $document, done) {
|
||||
done(null, $window.angular.injector('NG')('$location').search());
|
||||
done(null, $window.angular.injector('ng')('$location').search());
|
||||
});
|
||||
};
|
||||
|
||||
api.hash = function() {
|
||||
return this.addFutureAction('$location.hash()', function($window, $document, done) {
|
||||
done(null, $window.angular.injector('NG')('$location').hash());
|
||||
done(null, $window.angular.injector('ng')('$location').hash());
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ var XHR = window.XMLHttpRequest || function() {
|
|||
|
||||
/**
|
||||
* @ngdoc object
|
||||
* @name angular.module.NG.$browser
|
||||
* @name angular.module.ng.$browser
|
||||
* @requires $log
|
||||
* @description
|
||||
* This object has two goals:
|
||||
|
|
@ -21,7 +21,7 @@ var XHR = window.XMLHttpRequest || function() {
|
|||
* - hide all the global state in the browser caused by the window object
|
||||
* - abstract away all the browser specific features and inconsistencies
|
||||
*
|
||||
* For tests we provide {@link angular.module.NG_MOCK.$browser mock implementation} of the `$browser`
|
||||
* For tests we provide {@link angular.module.ngMock.$browser mock implementation} of the `$browser`
|
||||
* service, which can be used for convenient testing of the application without the interaction with
|
||||
* the real browser apis.
|
||||
*/
|
||||
|
|
@ -75,8 +75,8 @@ function Browser(window, document, body, XHR, $log, $sniffer) {
|
|||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name angular.module.NG.$browser#xhr
|
||||
* @methodOf angular.module.NG.$browser
|
||||
* @name angular.module.ng.$browser#xhr
|
||||
* @methodOf angular.module.ng.$browser
|
||||
*
|
||||
* @param {string} method Requested method (get|post|put|delete|head|json)
|
||||
* @param {string} url Requested url
|
||||
|
|
@ -154,8 +154,8 @@ function Browser(window, document, body, XHR, $log, $sniffer) {
|
|||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name angular.module.NG.$browser#addPollFn
|
||||
* @methodOf angular.module.NG.$browser
|
||||
* @name angular.module.ng.$browser#addPollFn
|
||||
* @methodOf angular.module.ng.$browser
|
||||
*
|
||||
* @param {function()} fn Poll function to add
|
||||
*
|
||||
|
|
@ -194,8 +194,8 @@ function Browser(window, document, body, XHR, $log, $sniffer) {
|
|||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name angular.module.NG.$browser#url
|
||||
* @methodOf angular.module.NG.$browser
|
||||
* @name angular.module.ng.$browser#url
|
||||
* @methodOf angular.module.ng.$browser
|
||||
*
|
||||
* @description
|
||||
* GETTER:
|
||||
|
|
@ -208,7 +208,7 @@ function Browser(window, document, body, XHR, $log, $sniffer) {
|
|||
* Returns its own instance to allow chaining
|
||||
*
|
||||
* NOTE: this api is intended for use only by the $location service. Please use the
|
||||
* {@link angular.module.NG.$location $location service} to change url.
|
||||
* {@link angular.module.ng.$location $location service} to change url.
|
||||
*
|
||||
* @param {string} url New url (when used as setter)
|
||||
* @param {boolean=} replace Should new url replace current history record ?
|
||||
|
|
@ -245,8 +245,8 @@ function Browser(window, document, body, XHR, $log, $sniffer) {
|
|||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name angular.module.NG.$browser#onUrlChange
|
||||
* @methodOf angular.module.NG.$browser
|
||||
* @name angular.module.ng.$browser#onUrlChange
|
||||
* @methodOf angular.module.ng.$browser
|
||||
* @TODO(vojta): refactor to use node's syntax for events
|
||||
*
|
||||
* @description
|
||||
|
|
@ -262,7 +262,7 @@ function Browser(window, document, body, XHR, $log, $sniffer) {
|
|||
* The listener gets called with new url as parameter.
|
||||
*
|
||||
* NOTE: this api is intended for use only by the $location service. Please use the
|
||||
* {@link angular.module.NG.$location $location service} to monitor url changes in angular apps.
|
||||
* {@link angular.module.ng.$location $location service} to monitor url changes in angular apps.
|
||||
*
|
||||
* @param {function(string)} listener Listener function to be called when url changes.
|
||||
* @return {function(string)} Returns the registered listener fn - handy if the fn is anonymous.
|
||||
|
|
@ -295,8 +295,8 @@ function Browser(window, document, body, XHR, $log, $sniffer) {
|
|||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name angular.module.NG.$browser#cookies
|
||||
* @methodOf angular.module.NG.$browser
|
||||
* @name angular.module.ng.$browser#cookies
|
||||
* @methodOf angular.module.ng.$browser
|
||||
*
|
||||
* @param {string=} name Cookie name
|
||||
* @param {string=} value Cokkie value
|
||||
|
|
@ -356,8 +356,8 @@ function Browser(window, document, body, XHR, $log, $sniffer) {
|
|||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name angular.module.NG.$browser#defer
|
||||
* @methodOf angular.module.NG.$browser
|
||||
* @name angular.module.ng.$browser#defer
|
||||
* @methodOf angular.module.ng.$browser
|
||||
* @param {function()} fn A function, who's execution should be defered.
|
||||
* @param {number=} [delay=0] of milliseconds to defer the function execution.
|
||||
* @returns {*} DeferId that can be used to cancel the task via `$browser.defer.cancel()`.
|
||||
|
|
@ -385,8 +385,8 @@ function Browser(window, document, body, XHR, $log, $sniffer) {
|
|||
/**
|
||||
* THIS DOC IS NOT VISIBLE because ngdocs can't process docs for foo#method.method
|
||||
*
|
||||
* @name angular.module.NG.$browser#defer.cancel
|
||||
* @methodOf angular.module.NG.$browser.defer
|
||||
* @name angular.module.ng.$browser#defer.cancel
|
||||
* @methodOf angular.module.ng.$browser.defer
|
||||
*
|
||||
* @description
|
||||
* Cancels a defered task identified with `deferId`.
|
||||
|
|
@ -411,8 +411,8 @@ function Browser(window, document, body, XHR, $log, $sniffer) {
|
|||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name angular.module.NG.$browser#addCss
|
||||
* @methodOf angular.module.NG.$browser
|
||||
* @name angular.module.ng.$browser#addCss
|
||||
* @methodOf angular.module.ng.$browser
|
||||
*
|
||||
* @param {string} url Url to css file
|
||||
* @description
|
||||
|
|
@ -429,8 +429,8 @@ function Browser(window, document, body, XHR, $log, $sniffer) {
|
|||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name angular.module.NG.$browser#addJs
|
||||
* @methodOf angular.module.NG.$browser
|
||||
* @name angular.module.ng.$browser#addJs
|
||||
* @methodOf angular.module.ng.$browser
|
||||
*
|
||||
* @param {string} url Url to js file
|
||||
*
|
||||
|
|
|
|||
|
|
@ -79,12 +79,12 @@ function $CompileProvider(){
|
|||
|
||||
/**
|
||||
* @ngdoc function
|
||||
* @name angular.module.NG.$compile
|
||||
* @name angular.module.ng.$compile
|
||||
* @function
|
||||
*
|
||||
* @description
|
||||
* Compiles a piece of HTML string or DOM into a template and produces a template function, which
|
||||
* can then be used to link {@link angular.module.NG.$rootScope.Scope scope} and the template together.
|
||||
* can then be used to link {@link angular.module.ng.$rootScope.Scope scope} and the template together.
|
||||
*
|
||||
* The compilation is a process of walking the DOM tree and trying to match DOM elements to
|
||||
* {@link angular.markup markup}, {@link angular.attrMarkup attrMarkup},
|
||||
|
|
@ -117,7 +117,7 @@ function $CompileProvider(){
|
|||
* @returns {function(scope[, cloneAttachFn])} a template function which is used to bind template
|
||||
* (a DOM element/tree) to a scope. Where:
|
||||
*
|
||||
* * `scope` - A {@link angular.module.NG.$rootScope.Scope Scope} to bind to.
|
||||
* * `scope` - A {@link angular.module.ng.$rootScope.Scope Scope} to bind to.
|
||||
* * `cloneAttachFn` - If `cloneAttachFn` is provided, then the link function will clone the
|
||||
* `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
|
||||
|
|
@ -136,14 +136,14 @@ function $CompileProvider(){
|
|||
* bring the view to life, the scope needs to run through a $digest phase which typically is done by
|
||||
* Angular automatically, except for the case when an application is being
|
||||
* {@link guide/dev_guide.bootstrap.manual_bootstrap} manually bootstrapped, in which case the
|
||||
* $digest phase must be invoked by calling {@link angular.module.NG.$rootScope.Scope#$apply}.
|
||||
* $digest phase must be invoked by calling {@link angular.module.ng.$rootScope.Scope#$apply}.
|
||||
*
|
||||
* If you need access to the bound view, there are two ways to do it:
|
||||
*
|
||||
* - 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>
|
||||
* var scope = angular.injector('NG')(function($rootScope, $compile){
|
||||
* var scope = angular.injector('ng')(function($rootScope, $compile){
|
||||
* var element = $compile('<p>{{total}}</p>')($rootScope);
|
||||
* });
|
||||
* </pre>
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
/**
|
||||
* @ngdoc object
|
||||
* @name angular.module.NG.$cookieStore
|
||||
* @name angular.module.ng.$cookieStore
|
||||
* @requires $cookies
|
||||
*
|
||||
* @description
|
||||
|
|
@ -17,8 +17,8 @@ function $CookieStoreProvider(){
|
|||
return {
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name angular.module.NG.$cookieStore#get
|
||||
* @methodOf angular.module.NG.$cookieStore
|
||||
* @name angular.module.ng.$cookieStore#get
|
||||
* @methodOf angular.module.ng.$cookieStore
|
||||
*
|
||||
* @description
|
||||
* Returns the value of given cookie key
|
||||
|
|
@ -32,8 +32,8 @@ function $CookieStoreProvider(){
|
|||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name angular.module.NG.$cookieStore#put
|
||||
* @methodOf angular.module.NG.$cookieStore
|
||||
* @name angular.module.ng.$cookieStore#put
|
||||
* @methodOf angular.module.ng.$cookieStore
|
||||
*
|
||||
* @description
|
||||
* Sets a value for given cookie key
|
||||
|
|
@ -47,8 +47,8 @@ function $CookieStoreProvider(){
|
|||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name angular.module.NG.$cookieStore#remove
|
||||
* @methodOf angular.module.NG.$cookieStore
|
||||
* @name angular.module.ng.$cookieStore#remove
|
||||
* @methodOf angular.module.ng.$cookieStore
|
||||
*
|
||||
* @description
|
||||
* Remove given cookie
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
/**
|
||||
* @ngdoc object
|
||||
* @name angular.module.NG.$cookies
|
||||
* @name angular.module.ng.$cookies
|
||||
* @requires $browser
|
||||
*
|
||||
* @description
|
||||
|
|
|
|||
|
|
@ -2,13 +2,13 @@
|
|||
|
||||
/**
|
||||
* @ngdoc function
|
||||
* @name angular.module.NG.$defer
|
||||
* @name angular.module.ng.$defer
|
||||
* @requires $browser
|
||||
*
|
||||
* @description
|
||||
* Delegates to {@link angular.module.NG.$browser#defer $browser.defer}, but wraps the `fn` function
|
||||
* Delegates to {@link angular.module.ng.$browser#defer $browser.defer}, but wraps the `fn` function
|
||||
* into a try/catch block and delegates any exceptions to
|
||||
* {@link angular.module.NG.$exceptionHandler $exceptionHandler} service.
|
||||
* {@link angular.module.ng.$exceptionHandler $exceptionHandler} service.
|
||||
*
|
||||
* In tests you can use `$browser.defer.flush()` to flush the queue of deferred functions.
|
||||
*
|
||||
|
|
@ -19,8 +19,8 @@
|
|||
|
||||
/**
|
||||
* @ngdoc function
|
||||
* @name angular.module.NG.$defer#cancel
|
||||
* @methodOf angular.module.NG.$defer
|
||||
* @name angular.module.ng.$defer#cancel
|
||||
* @methodOf angular.module.ng.$defer
|
||||
*
|
||||
* @description
|
||||
* Cancels a defered task identified with `deferId`.
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
/**
|
||||
* @ngdoc object
|
||||
* @name angular.module.NG.$document
|
||||
* @name angular.module.ng.$document
|
||||
* @requires $window
|
||||
*
|
||||
* @description
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
/**
|
||||
* @ngdoc function
|
||||
* @name angular.module.NG.$exceptionHandler
|
||||
* @name angular.module.ng.$exceptionHandler
|
||||
* @requires $log
|
||||
*
|
||||
* @description
|
||||
|
|
@ -11,7 +11,7 @@
|
|||
* the browser console.
|
||||
*
|
||||
* In unit tests, if `angular-mocks.js` is loaded, this service is overriden by
|
||||
* {@link angular.module.NG_MOCK.$exceptionHandler mock $exceptionHandler}
|
||||
* {@link angular.module.ngMock.$exceptionHandler mock $exceptionHandler}
|
||||
*/
|
||||
function $ExceptionHandlerProvider(){
|
||||
this.$get = ['$log', function($log){
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
/**
|
||||
* @ngdoc object
|
||||
* @name angular.module.NG.$filterProvider
|
||||
* @name angular.module.ng.$filterProvider
|
||||
* @description
|
||||
*
|
||||
* Filters are just functions which transform input to an output. However filters need to be Dependency Injected. To
|
||||
|
|
@ -50,8 +50,8 @@
|
|||
*/
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name angular.module.NG.$filterProvider#register
|
||||
* @methodOf angular.module.NG.$filterProvider
|
||||
* @name angular.module.ng.$filterProvider#register
|
||||
* @methodOf angular.module.ng.$filterProvider
|
||||
* @description
|
||||
* Register filter factory function.
|
||||
*
|
||||
|
|
@ -62,7 +62,7 @@
|
|||
|
||||
/**
|
||||
* @ngdoc function
|
||||
* @name angular.module.NG.$filter
|
||||
* @name angular.module.ng.$filter
|
||||
* @function
|
||||
* @description
|
||||
* Filters are used for formatting data displayed to the user.
|
||||
|
|
|
|||
|
|
@ -2,14 +2,14 @@
|
|||
|
||||
/**
|
||||
* @ngdoc filter
|
||||
* @name angular.module.NG.$filter.filter
|
||||
* @name angular.module.ng.$filter.filter
|
||||
* @function
|
||||
*
|
||||
* @description
|
||||
* Selects a subset of items from `array` and returns it as a new array.
|
||||
*
|
||||
* Note: This function is used to augment the `Array` type in Angular expressions. See
|
||||
* {@link angular.module.NG.$filter} for more information about Angular arrays.
|
||||
* {@link angular.module.ng.$filter} for more information about Angular arrays.
|
||||
*
|
||||
* @param {Array} array The source array.
|
||||
* @param {string|Object|function()} expression The predicate to be used for selecting items from
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
/**
|
||||
* @ngdoc filter
|
||||
* @name angular.module.NG.$filter.currency
|
||||
* @name angular.module.ng.$filter.currency
|
||||
* @function
|
||||
*
|
||||
* @description
|
||||
|
|
@ -53,7 +53,7 @@ function currencyFilter($locale) {
|
|||
|
||||
/**
|
||||
* @ngdoc filter
|
||||
* @name angular.module.NG.$filter.number
|
||||
* @name angular.module.ng.$filter.number
|
||||
* @function
|
||||
*
|
||||
* @description
|
||||
|
|
@ -239,7 +239,7 @@ var DATE_FORMATS_SPLIT = /((?:[^yMdHhmsaZE']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|d+
|
|||
|
||||
/**
|
||||
* @ngdoc filter
|
||||
* @name angular.module.NG.$filter.date
|
||||
* @name angular.module.ng.$filter.date
|
||||
* @function
|
||||
*
|
||||
* @description
|
||||
|
|
@ -364,7 +364,7 @@ function dateFilter($locale) {
|
|||
|
||||
/**
|
||||
* @ngdoc filter
|
||||
* @name angular.module.NG.$filter.json
|
||||
* @name angular.module.ng.$filter.json
|
||||
* @function
|
||||
*
|
||||
* @description
|
||||
|
|
@ -400,7 +400,7 @@ function jsonFilter() {
|
|||
|
||||
/**
|
||||
* @ngdoc filter
|
||||
* @name angular.module.NG.$filter.lowercase
|
||||
* @name angular.module.ng.$filter.lowercase
|
||||
* @function
|
||||
* @description
|
||||
* Converts string to lowercase.
|
||||
|
|
@ -411,7 +411,7 @@ var lowercaseFilter = valueFn(lowercase);
|
|||
|
||||
/**
|
||||
* @ngdoc filter
|
||||
* @name angular.module.NG.$filter.uppercase
|
||||
* @name angular.module.ng.$filter.uppercase
|
||||
* @function
|
||||
* @description
|
||||
* Converts string to uppercase.
|
||||
|
|
@ -422,7 +422,7 @@ var uppercaseFilter = valueFn(uppercase);
|
|||
|
||||
/**
|
||||
* @ngdoc filter
|
||||
* @name angular.module.NG.$filter.html
|
||||
* @name angular.module.ng.$filter.html
|
||||
* @function
|
||||
*
|
||||
* @description
|
||||
|
|
@ -524,7 +524,7 @@ function htmlFilter() {
|
|||
|
||||
/**
|
||||
* @ngdoc filter
|
||||
* @name angular.module.NG.$filter.linky
|
||||
* @name angular.module.ng.$filter.linky
|
||||
* @function
|
||||
*
|
||||
* @description
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
/**
|
||||
* @ngdoc function
|
||||
* @name angular.module.NG.$filter.limitTo
|
||||
* @name angular.module.ng.$filter.limitTo
|
||||
* @function
|
||||
*
|
||||
* @description
|
||||
|
|
@ -11,7 +11,7 @@
|
|||
* value and sign (positive or negative) of `limit`.
|
||||
*
|
||||
* Note: This function is used to augment the `Array` type in Angular expressions. See
|
||||
* {@link angular.module.NG.$filter} for more information about Angular arrays.
|
||||
* {@link angular.module.ng.$filter} for more information about Angular arrays.
|
||||
*
|
||||
* @param {Array} array Source array to be limited.
|
||||
* @param {string|Number} limit The length of the returned array. If the `limit` number is
|
||||
|
|
|
|||
|
|
@ -2,14 +2,14 @@
|
|||
|
||||
/**
|
||||
* @ngdoc function
|
||||
* @name angular.module.NG.$filter.orderBy
|
||||
* @name angular.module.ng.$filter.orderBy
|
||||
* @function
|
||||
*
|
||||
* @description
|
||||
* Orders a specified `array` by the `expression` predicate.
|
||||
*
|
||||
* Note: this function is used to augment the `Array` type in Angular expressions. See
|
||||
* {@link angular.module.NG.$filter} for more informaton about Angular arrays.
|
||||
* {@link angular.module.ng.$filter} for more informaton about Angular arrays.
|
||||
*
|
||||
* @param {Array} array The array to sort.
|
||||
* @param {function(*)|string|Array.<(function(*)|string)>} expression A predicate to be
|
||||
|
|
|
|||
|
|
@ -2,20 +2,20 @@
|
|||
|
||||
/**
|
||||
* @ngdoc object
|
||||
* @name angular.module.NG.$formFactory
|
||||
* @name angular.module.ng.$formFactory
|
||||
*
|
||||
* @description
|
||||
* Use `$formFactory` to create a new instance of a {@link angular.module.NG.$formFactory.Form Form}
|
||||
* Use `$formFactory` to create a new instance of a {@link angular.module.ng.$formFactory.Form Form}
|
||||
* controller or to find the nearest form instance for a given DOM element.
|
||||
*
|
||||
* The form instance is a collection of widgets, and is responsible for life cycle and validation
|
||||
* of widget.
|
||||
*
|
||||
* Keep in mind that both form and widget instances are {@link api/angular.module.NG.$rootScope.Scope scopes}.
|
||||
* Keep in mind that both form and widget instances are {@link api/angular.module.ng.$rootScope.Scope scopes}.
|
||||
*
|
||||
* @param {Form=} parentForm The form which should be the parent form of the new form controller.
|
||||
* If none specified default to the `rootForm`.
|
||||
* @returns {Form} A new {@link angular.module.NG.$formFactory.Form Form} instance.
|
||||
* @returns {Form} A new {@link angular.module.ng.$formFactory.Form Form} instance.
|
||||
*
|
||||
* @example
|
||||
*
|
||||
|
|
@ -97,7 +97,7 @@
|
|||
|
||||
/**
|
||||
* @ngdoc object
|
||||
* @name angular.module.NG.$formFactory.Form
|
||||
* @name angular.module.ng.$formFactory.Form
|
||||
* @description
|
||||
* The `Form` is a controller which keeps track of the validity of the widgets contained within it.
|
||||
*/
|
||||
|
|
@ -109,7 +109,7 @@ function $FormFactoryProvider() {
|
|||
/**
|
||||
* @ngdoc proprety
|
||||
* @name rootForm
|
||||
* @propertyOf angular.module.NG.$formFactory
|
||||
* @propertyOf angular.module.ng.$formFactory
|
||||
* @description
|
||||
* Static property on `$formFactory`
|
||||
*
|
||||
|
|
@ -122,7 +122,7 @@ function $FormFactoryProvider() {
|
|||
/**
|
||||
* @ngdoc method
|
||||
* @name forElement
|
||||
* @methodOf angular.module.NG.$formFactory
|
||||
* @methodOf angular.module.ng.$formFactory
|
||||
* @description
|
||||
* Static method on `$formFactory` service.
|
||||
*
|
||||
|
|
@ -149,7 +149,7 @@ function $FormFactoryProvider() {
|
|||
/**
|
||||
* @ngdoc property
|
||||
* @name $error
|
||||
* @propertyOf angular.module.NG.$formFactory.Form
|
||||
* @propertyOf angular.module.ng.$formFactory.Form
|
||||
* @description
|
||||
* Property of the form and widget instance.
|
||||
*
|
||||
|
|
@ -161,7 +161,7 @@ function $FormFactoryProvider() {
|
|||
/**
|
||||
* @ngdoc property
|
||||
* @name $invalid
|
||||
* @propertyOf angular.module.NG.$formFactory.Form
|
||||
* @propertyOf angular.module.ng.$formFactory.Form
|
||||
* @description
|
||||
* Property of the form and widget instance.
|
||||
*
|
||||
|
|
@ -171,7 +171,7 @@ function $FormFactoryProvider() {
|
|||
/**
|
||||
* @ngdoc property
|
||||
* @name $valid
|
||||
* @propertyOf angular.module.NG.$formFactory.Form
|
||||
* @propertyOf angular.module.ng.$formFactory.Form
|
||||
* @description
|
||||
* Property of the form and widget instance.
|
||||
*
|
||||
|
|
@ -180,8 +180,8 @@ function $FormFactoryProvider() {
|
|||
|
||||
/**
|
||||
* @ngdoc event
|
||||
* @name angular.module.NG.$formFactory.Form#$valid
|
||||
* @eventOf angular.module.NG.$formFactory.Form
|
||||
* @name angular.module.ng.$formFactory.Form#$valid
|
||||
* @eventOf angular.module.ng.$formFactory.Form
|
||||
* @eventType listen on form
|
||||
* @description
|
||||
* Upon receiving the `$valid` event from the widget update the `$error`, `$valid` and `$invalid`
|
||||
|
|
@ -194,8 +194,8 @@ function $FormFactoryProvider() {
|
|||
|
||||
/**
|
||||
* @ngdoc event
|
||||
* @name angular.module.NG.$formFactory.Form#$invalid
|
||||
* @eventOf angular.module.NG.$formFactory.Form
|
||||
* @name angular.module.ng.$formFactory.Form#$invalid
|
||||
* @eventOf angular.module.ng.$formFactory.Form
|
||||
* @eventType listen on form
|
||||
* @description
|
||||
* Upon receiving the `$invalid` event from the widget update the `$error`, `$valid` and `$invalid`
|
||||
|
|
@ -208,8 +208,8 @@ function $FormFactoryProvider() {
|
|||
|
||||
/**
|
||||
* @ngdoc event
|
||||
* @name angular.module.NG.$formFactory.Form#$validate
|
||||
* @eventOf angular.module.NG.$formFactory.Form
|
||||
* @name angular.module.ng.$formFactory.Form#$validate
|
||||
* @eventOf angular.module.ng.$formFactory.Form
|
||||
* @eventType emit on widget
|
||||
* @description
|
||||
* Emit the `$validate` event on the widget, giving a widget a chance to emit a
|
||||
|
|
@ -219,8 +219,8 @@ function $FormFactoryProvider() {
|
|||
|
||||
/**
|
||||
* @ngdoc event
|
||||
* @name angular.module.NG.$formFactory.Form#$viewChange
|
||||
* @eventOf angular.module.NG.$formFactory.Form
|
||||
* @name angular.module.ng.$formFactory.Form#$viewChange
|
||||
* @eventOf angular.module.ng.$formFactory.Form
|
||||
* @eventType listen on widget
|
||||
* @description
|
||||
* A widget is responsible for emitting this event whenever the view changes do to user interaction.
|
||||
|
|
@ -293,7 +293,7 @@ function $FormFactoryProvider() {
|
|||
/**
|
||||
* @ngdoc method
|
||||
* @name $createWidget
|
||||
* @methodOf angular.module.NG.$formFactory.Form
|
||||
* @methodOf angular.module.ng.$formFactory.Form
|
||||
* @description
|
||||
*
|
||||
* Use form's `$createWidget` instance method to create new widgets. The widgets can be created
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
/**
|
||||
* @ngdoc object
|
||||
* @name angular.module.NG.$locale
|
||||
* @name angular.module.ng.$locale
|
||||
*
|
||||
* @description
|
||||
* $locale service provides localization rules for various Angular components. As of right now the
|
||||
|
|
|
|||
|
|
@ -205,8 +205,8 @@ LocationUrl.prototype = LocationHashbangUrl.prototype = {
|
|||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name angular.module.NG.$location#absUrl
|
||||
* @methodOf angular.module.NG.$location
|
||||
* @name angular.module.ng.$location#absUrl
|
||||
* @methodOf angular.module.ng.$location
|
||||
*
|
||||
* @description
|
||||
* This method is getter only.
|
||||
|
|
@ -220,8 +220,8 @@ LocationUrl.prototype = LocationHashbangUrl.prototype = {
|
|||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name angular.module.NG.$location#url
|
||||
* @methodOf angular.module.NG.$location
|
||||
* @name angular.module.ng.$location#url
|
||||
* @methodOf angular.module.ng.$location
|
||||
*
|
||||
* @description
|
||||
* This method is getter / setter.
|
||||
|
|
@ -247,8 +247,8 @@ LocationUrl.prototype = LocationHashbangUrl.prototype = {
|
|||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name angular.module.NG.$location#protocol
|
||||
* @methodOf angular.module.NG.$location
|
||||
* @name angular.module.ng.$location#protocol
|
||||
* @methodOf angular.module.ng.$location
|
||||
*
|
||||
* @description
|
||||
* This method is getter only.
|
||||
|
|
@ -261,8 +261,8 @@ LocationUrl.prototype = LocationHashbangUrl.prototype = {
|
|||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name angular.module.NG.$location#host
|
||||
* @methodOf angular.module.NG.$location
|
||||
* @name angular.module.ng.$location#host
|
||||
* @methodOf angular.module.ng.$location
|
||||
*
|
||||
* @description
|
||||
* This method is getter only.
|
||||
|
|
@ -275,8 +275,8 @@ LocationUrl.prototype = LocationHashbangUrl.prototype = {
|
|||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name angular.module.NG.$location#port
|
||||
* @methodOf angular.module.NG.$location
|
||||
* @name angular.module.ng.$location#port
|
||||
* @methodOf angular.module.ng.$location
|
||||
*
|
||||
* @description
|
||||
* This method is getter only.
|
||||
|
|
@ -289,8 +289,8 @@ LocationUrl.prototype = LocationHashbangUrl.prototype = {
|
|||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name angular.module.NG.$location#path
|
||||
* @methodOf angular.module.NG.$location
|
||||
* @name angular.module.ng.$location#path
|
||||
* @methodOf angular.module.ng.$location
|
||||
*
|
||||
* @description
|
||||
* This method is getter / setter.
|
||||
|
|
@ -311,8 +311,8 @@ LocationUrl.prototype = LocationHashbangUrl.prototype = {
|
|||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name angular.module.NG.$location#search
|
||||
* @methodOf angular.module.NG.$location
|
||||
* @name angular.module.ng.$location#search
|
||||
* @methodOf angular.module.ng.$location
|
||||
*
|
||||
* @description
|
||||
* This method is getter / setter.
|
||||
|
|
@ -344,8 +344,8 @@ LocationUrl.prototype = LocationHashbangUrl.prototype = {
|
|||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name angular.module.NG.$location#hash
|
||||
* @methodOf angular.module.NG.$location
|
||||
* @name angular.module.ng.$location#hash
|
||||
* @methodOf angular.module.ng.$location
|
||||
*
|
||||
* @description
|
||||
* This method is getter / setter.
|
||||
|
|
@ -361,8 +361,8 @@ LocationUrl.prototype = LocationHashbangUrl.prototype = {
|
|||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name angular.module.NG.$location#replace
|
||||
* @methodOf angular.module.NG.$location
|
||||
* @name angular.module.ng.$location#replace
|
||||
* @methodOf angular.module.ng.$location
|
||||
*
|
||||
* @description
|
||||
* If called, all changes to $location during current `$digest` will be replacing current history
|
||||
|
|
@ -397,7 +397,7 @@ function locationGetterSetter(property, preprocess) {
|
|||
|
||||
/**
|
||||
* @ngdoc object
|
||||
* @name angular.module.NG.$location
|
||||
* @name angular.module.ng.$location
|
||||
*
|
||||
* @requires $browser
|
||||
* @requires $sniffer
|
||||
|
|
@ -422,9 +422,9 @@ function locationGetterSetter(property, preprocess) {
|
|||
|
||||
/**
|
||||
* @ngdoc object
|
||||
* @name angular.module.NG.$locationProvider
|
||||
* @name angular.module.ng.$locationProvider
|
||||
* @description
|
||||
* Use the `$locationPrvoder` to configure how the application deep linking paths are stored.
|
||||
* Use the `$locationProvider` to configure how the application deep linking paths are stored.
|
||||
*/
|
||||
function $LocationProvider(){
|
||||
var hashPrefix = '',
|
||||
|
|
@ -432,11 +432,11 @@ function $LocationProvider(){
|
|||
|
||||
/**
|
||||
* @ngdoc property
|
||||
* @name angular.module.NG.$locationProvider#hashPrefix
|
||||
* @methodOf angular.module.NG.$locationProvider
|
||||
* @name angular.module.ng.$locationProvider#hashPrefix
|
||||
* @methodOf angular.module.ng.$locationProvider
|
||||
* @description
|
||||
* @param {string=} prefix Prefix for hash part (containing path and search)
|
||||
* @returns current value if used as getter or itself (chaining) if used as setter
|
||||
* @returns {*} current value if used as getter or itself (chaining) if used as setter
|
||||
*/
|
||||
this.hashPrefix = function(prefix) {
|
||||
if (isDefined(prefix)) {
|
||||
|
|
@ -449,11 +449,11 @@ function $LocationProvider(){
|
|||
|
||||
/**
|
||||
* @ngdoc property
|
||||
* @name angular.module.NG.$locationProvider#hashPrefix
|
||||
* @propertyOf angular.module.NG.$locationProvider
|
||||
* @name angular.module.ng.$locationProvider#hashPrefix
|
||||
* @methodOf angular.module.ng.$locationProvider
|
||||
* @description
|
||||
* @param mode= Use HTML5 strategy if available.
|
||||
* @returns current value if used as getter or itself (chaining) if used as setter
|
||||
* @param {string=} mode Use HTML5 strategy if available.
|
||||
* @returns {*} current value if used as getter or itself (chaining) if used as setter
|
||||
*/
|
||||
this.html5Mode = function(mode) {
|
||||
if (isDefined(mode)) {
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
/**
|
||||
* @ngdoc object
|
||||
* @name angular.module.NG.$log
|
||||
* @name angular.module.ng.$log
|
||||
* @requires $window
|
||||
*
|
||||
* @description
|
||||
|
|
@ -40,8 +40,8 @@ function $LogProvider(){
|
|||
return {
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name angular.module.NG.$log#log
|
||||
* @methodOf angular.module.NG.$log
|
||||
* @name angular.module.ng.$log#log
|
||||
* @methodOf angular.module.ng.$log
|
||||
*
|
||||
* @description
|
||||
* Write a log message
|
||||
|
|
@ -50,8 +50,8 @@ function $LogProvider(){
|
|||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name angular.module.NG.$log#warn
|
||||
* @methodOf angular.module.NG.$log
|
||||
* @name angular.module.ng.$log#warn
|
||||
* @methodOf angular.module.ng.$log
|
||||
*
|
||||
* @description
|
||||
* Write a warning message
|
||||
|
|
@ -60,8 +60,8 @@ function $LogProvider(){
|
|||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name angular.module.NG.$log#info
|
||||
* @methodOf angular.module.NG.$log
|
||||
* @name angular.module.ng.$log#info
|
||||
* @methodOf angular.module.ng.$log
|
||||
*
|
||||
* @description
|
||||
* Write an information message
|
||||
|
|
@ -70,8 +70,8 @@ function $LogProvider(){
|
|||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name angular.module.NG.$log#error
|
||||
* @methodOf angular.module.NG.$log
|
||||
* @name angular.module.ng.$log#error
|
||||
* @methodOf angular.module.ng.$log
|
||||
*
|
||||
* @description
|
||||
* Write an error message
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
/**
|
||||
* @ngdoc object
|
||||
* @name angular.module.NG.$resource
|
||||
* @name angular.module.ng.$resource
|
||||
* @requires $xhr.cache
|
||||
*
|
||||
* @description
|
||||
|
|
@ -10,7 +10,7 @@
|
|||
* [RESTful](http://en.wikipedia.org/wiki/Representational_State_Transfer) server-side data sources.
|
||||
*
|
||||
* The returned resource object has action methods which provide high-level behaviors without
|
||||
* the need to interact with the low level {@link angular.module.NG.$xhr $xhr} service or
|
||||
* the need to interact with the low level {@link angular.module.ng.$xhr $xhr} service or
|
||||
* raw XMLHttpRequest.
|
||||
*
|
||||
* @param {string} url A parameterized URL template with parameters prefixed by `:` as in
|
||||
|
|
@ -57,7 +57,7 @@
|
|||
* 'remove': {method:'DELETE'},
|
||||
* 'delete': {method:'DELETE'} };
|
||||
*
|
||||
* Calling these methods invoke an {@link angular.module.NG.$xhr} with the specified http method,
|
||||
* Calling these methods invoke an {@link angular.module.ng.$xhr} with the specified http method,
|
||||
* destination and parameters. When the data is returned from the server then the object is an
|
||||
* instance of the resource class `save`, `remove` and `delete` actions are available on it as
|
||||
* methods with the `$` prefix. This allows you to easily perform CRUD operations (create, read,
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
/**
|
||||
* @ngdoc object
|
||||
* @name angular.module.NG.$route
|
||||
* @name angular.module.ng.$route
|
||||
* @requires $location
|
||||
* @requires $routeParams
|
||||
*
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
* definition. It is used for deep-linking URLs to controllers and views (HTML partials).
|
||||
*
|
||||
* The `$route` service is typically used in conjunction with {@link angular.widget.ng:view ng:view}
|
||||
* widget and the {@link angular.module.NG.$routeParams $routeParams} service.
|
||||
* widget and the {@link angular.module.ng.$routeParams $routeParams} service.
|
||||
*
|
||||
* @example
|
||||
This example shows how changing the URL hash causes the <tt>$route</tt>
|
||||
|
|
@ -67,8 +67,8 @@ function $RouteProvider(){
|
|||
function( $rootScope, $location, $routeParams) {
|
||||
/**
|
||||
* @ngdoc event
|
||||
* @name angular.module.NG.$route#$beforeRouteChange
|
||||
* @eventOf angular.module.NG.$route
|
||||
* @name angular.module.ng.$route#$beforeRouteChange
|
||||
* @eventOf angular.module.ng.$route
|
||||
* @eventType broadcast on root scope
|
||||
* @description
|
||||
* Broadcasted before a route change.
|
||||
|
|
@ -79,14 +79,14 @@ function $RouteProvider(){
|
|||
* The `Route` object extends the route definition with the following properties.
|
||||
*
|
||||
* * `scope` - The instance of the route controller.
|
||||
* * `params` - The current {@link angular.module.NG.$routeParams params}.
|
||||
* * `params` - The current {@link angular.module.ng.$routeParams params}.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ngdoc event
|
||||
* @name angular.module.NG.$route#$afterRouteChange
|
||||
* @eventOf angular.module.NG.$route
|
||||
* @name angular.module.ng.$route#$afterRouteChange
|
||||
* @eventOf angular.module.ng.$route
|
||||
* @eventType broadcast on root scope
|
||||
* @description
|
||||
* Broadcasted after a route change.
|
||||
|
|
@ -97,14 +97,14 @@ function $RouteProvider(){
|
|||
* The `Route` object extends the route definition with the following properties.
|
||||
*
|
||||
* * `scope` - The instance of the route controller.
|
||||
* * `params` - The current {@link angular.module.NG.$routeParams params}.
|
||||
* * `params` - The current {@link angular.module.ng.$routeParams params}.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ngdoc event
|
||||
* @name angular.module.NG.$route#$routeUpdate
|
||||
* @eventOf angular.module.NG.$route
|
||||
* @name angular.module.ng.$route#$routeUpdate
|
||||
* @eventOf angular.module.ng.$route
|
||||
* @eventType emit on the current route scope
|
||||
* @description
|
||||
*
|
||||
|
|
@ -122,8 +122,8 @@ function $RouteProvider(){
|
|||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name angular.module.NG.$route#parent
|
||||
* @methodOf angular.module.NG.$route
|
||||
* @name angular.module.ng.$route#parent
|
||||
* @methodOf angular.module.ng.$route
|
||||
*
|
||||
* @param {Scope} [scope=rootScope] Scope to be used as parent for newly created
|
||||
* `$route.current.scope` scopes.
|
||||
|
|
@ -138,8 +138,8 @@ function $RouteProvider(){
|
|||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name angular.module.NG.$route#when
|
||||
* @methodOf angular.module.NG.$route
|
||||
* @name angular.module.ng.$route#when
|
||||
* @methodOf angular.module.ng.$route
|
||||
*
|
||||
* @param {string} path Route path (matched against `$location.hash`)
|
||||
* @param {Object} route Mapping information to be assigned to `$route.current` on route
|
||||
|
|
@ -153,7 +153,7 @@ function $RouteProvider(){
|
|||
* {@link angular.widget.ng:view ng:view} or
|
||||
* {@link angular.widget.ng:include ng:include} widgets.
|
||||
* - `redirectTo` – {(string|function())=} – value to update
|
||||
* {@link angular.module.NG.$location $location} path with and trigger route redirection.
|
||||
* {@link angular.module.ng.$location $location} path with and trigger route redirection.
|
||||
*
|
||||
* If `redirectTo` is a function, it will be called with the following parameters:
|
||||
*
|
||||
|
|
@ -170,7 +170,7 @@ function $RouteProvider(){
|
|||
*
|
||||
* If the option is set to false and url in the browser changes, then
|
||||
* $routeUpdate event is emited on the current route scope. You can use this event to
|
||||
* react to {@link angular.module.NG.$routeParams} changes:
|
||||
* react to {@link angular.module.ng.$routeParams} changes:
|
||||
*
|
||||
* function MyCtrl($route, $routeParams) {
|
||||
* this.$on('$routeUpdate', function() {
|
||||
|
|
@ -193,8 +193,8 @@ function $RouteProvider(){
|
|||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name angular.module.NG.$route#otherwise
|
||||
* @methodOf angular.module.NG.$route
|
||||
* @name angular.module.ng.$route#otherwise
|
||||
* @methodOf angular.module.ng.$route
|
||||
*
|
||||
* @description
|
||||
* Sets route definition that will be used on route change when no other route definition
|
||||
|
|
@ -208,12 +208,12 @@ function $RouteProvider(){
|
|||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name angular.module.NG.$route#reload
|
||||
* @methodOf angular.module.NG.$route
|
||||
* @name angular.module.ng.$route#reload
|
||||
* @methodOf angular.module.ng.$route
|
||||
*
|
||||
* @description
|
||||
* Causes `$route` service to reload (and recreate the `$route.current` scope) upon the next
|
||||
* eval even if {@link angular.module.NG.$location $location} hasn't changed.
|
||||
* eval even if {@link angular.module.ng.$location $location} hasn't changed.
|
||||
*/
|
||||
reload: function() {
|
||||
dirty++;
|
||||
|
|
|
|||
|
|
@ -2,13 +2,13 @@
|
|||
|
||||
/**
|
||||
* @ngdoc object
|
||||
* @name angular.module.NG.$routeParams
|
||||
* @name angular.module.ng.$routeParams
|
||||
* @requires $route
|
||||
*
|
||||
* @description
|
||||
* Current set of route parameters. The route parameters are a combination of the
|
||||
* {@link angular.module.NG.$location $location} `search()`, and `path()`. The `path` parameters
|
||||
* are extracted when the {@link angular.module.NG.$route $route} path is matched.
|
||||
* {@link angular.module.ng.$location $location} `search()`, and `path()`. The `path` parameters
|
||||
* are extracted when the {@link angular.module.ng.$route $route} path is matched.
|
||||
*
|
||||
* In case of parameter name collision, `path` params take precedence over `search` params.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -27,10 +27,10 @@
|
|||
|
||||
/**
|
||||
* @ngdoc object
|
||||
* @name angular.module.NG.$rootScope
|
||||
* @name angular.module.ng.$rootScope
|
||||
* @description
|
||||
*
|
||||
* Every application has a single root {@link angular.module.NG.$rootScope.Scope scope}.
|
||||
* Every application has a single root {@link angular.module.ng.$rootScope.Scope scope}.
|
||||
* All other scopes are child scopes of the root scope. Scopes provide mechanism for watching the model and provide
|
||||
* event processing life-cycle. See {@link guide/dev_guide.scopes developer guide on scopes}.
|
||||
*/
|
||||
|
|
@ -39,12 +39,12 @@ function $RootScopeProvider(){
|
|||
function( $injector, $exceptionHandler, $parse){
|
||||
/**
|
||||
* @ngdoc function
|
||||
* @name angular.module.NG.$rootScope.Scope
|
||||
* @name angular.module.ng.$rootScope.Scope
|
||||
*
|
||||
* @description
|
||||
* A root scope can be retrieved using the {@link angular.module.NG.$rootScope $rootScope} key from the
|
||||
* A root scope can be retrieved using the {@link angular.module.ng.$rootScope $rootScope} key from the
|
||||
* {@link angular.module.AUTO.$injector $injector}. Child scopes are created using the
|
||||
* {@link angular.module.NG.$rootScope.Scope#$new $new()} method. (Most scopes are created automatically when
|
||||
* {@link angular.module.ng.$rootScope.Scope#$new $new()} method. (Most scopes are created automatically when
|
||||
* compiled HTML template is executed.)
|
||||
*
|
||||
* Here is a simple scope snippet to show how you can interact with the scope.
|
||||
|
|
@ -90,7 +90,7 @@ function $RootScopeProvider(){
|
|||
*
|
||||
*
|
||||
* @param {Object.<string, function()>=} providers Map of service factory which need to be provided
|
||||
* for the current scope. Defaults to {@link angular.module.NG}.
|
||||
* for the current scope. Defaults to {@link angular.module.ng}.
|
||||
* @param {Object.<string, *>=} instanceCache Provides pre-instantiated services which should
|
||||
* append/override services provided by `providers`. This is handy when unit-testing and having
|
||||
* the need to override a default service.
|
||||
|
|
@ -110,8 +110,8 @@ function $RootScopeProvider(){
|
|||
|
||||
/**
|
||||
* @ngdoc property
|
||||
* @name angular.module.NG.$rootScope.Scope#$id
|
||||
* @propertyOf angular.module.NG.$rootScope.Scope
|
||||
* @name angular.module.ng.$rootScope.Scope#$id
|
||||
* @propertyOf angular.module.ng.$rootScope.Scope
|
||||
* @returns {number} Unique scope ID (monotonically increasing alphanumeric sequence) useful for
|
||||
* debugging.
|
||||
*/
|
||||
|
|
@ -120,17 +120,17 @@ function $RootScopeProvider(){
|
|||
Scope.prototype = {
|
||||
/**
|
||||
* @ngdoc function
|
||||
* @name angular.module.NG.$rootScope.Scope#$new
|
||||
* @methodOf angular.module.NG.$rootScope.Scope
|
||||
* @name angular.module.ng.$rootScope.Scope#$new
|
||||
* @methodOf angular.module.ng.$rootScope.Scope
|
||||
* @function
|
||||
*
|
||||
* @description
|
||||
* Creates a new child {@link angular.module.NG.$rootScope.Scope scope}. The new scope can optionally behave as a
|
||||
* controller. The parent scope will propagate the {@link angular.module.NG.$rootScope.Scope#$digest $digest()} and
|
||||
* {@link angular.module.NG.$rootScope.Scope#$digest $digest()} events. The scope can be removed from the scope
|
||||
* hierarchy using {@link angular.module.NG.$rootScope.Scope#$destroy $destroy()}.
|
||||
* Creates a new child {@link angular.module.ng.$rootScope.Scope scope}. The new scope can optionally behave as a
|
||||
* controller. The parent scope will propagate the {@link angular.module.ng.$rootScope.Scope#$digest $digest()} and
|
||||
* {@link angular.module.ng.$rootScope.Scope#$digest $digest()} events. The scope can be removed from the scope
|
||||
* hierarchy using {@link angular.module.ng.$rootScope.Scope#$destroy $destroy()}.
|
||||
*
|
||||
* {@link angular.module.NG.$rootScope.Scope#$destroy $destroy()} must be called on a scope when it is desired for
|
||||
* {@link angular.module.ng.$rootScope.Scope#$destroy $destroy()} 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.
|
||||
*
|
||||
|
|
@ -175,17 +175,17 @@ function $RootScopeProvider(){
|
|||
|
||||
/**
|
||||
* @ngdoc function
|
||||
* @name angular.module.NG.$rootScope.Scope#$watch
|
||||
* @methodOf angular.module.NG.$rootScope.Scope
|
||||
* @name angular.module.ng.$rootScope.Scope#$watch
|
||||
* @methodOf angular.module.ng.$rootScope.Scope
|
||||
* @function
|
||||
*
|
||||
* @description
|
||||
* Registers a `listener` callback to be executed whenever the `watchExpression` changes.
|
||||
*
|
||||
* - The `watchExpression` is called on every call to {@link angular.module.NG.$rootScope.Scope#$digest $digest()} and
|
||||
* should return the value which will be watched. (Since {@link angular.module.NG.$rootScope.Scope#$digest $digest()}
|
||||
* - The `watchExpression` is called on every call to {@link angular.module.ng.$rootScope.Scope#$digest $digest()} and
|
||||
* should return the value which will be watched. (Since {@link angular.module.ng.$rootScope.Scope#$digest $digest()}
|
||||
* reruns when it detects changes the `watchExpression` can execute multiple times per
|
||||
* {@link angular.module.NG.$rootScope.Scope#$digest $digest()} and should be idempotent.)
|
||||
* {@link angular.module.ng.$rootScope.Scope#$digest $digest()} and should be idempotent.)
|
||||
* - The `listener` is called only when the value from the current `watchExpression` and the
|
||||
* previous call to `watchExpression' are not equal. The inequality is determined according to
|
||||
* {@link angular.equals} function. To save the value of the object for later comparison
|
||||
|
|
@ -196,15 +196,15 @@ function $RootScopeProvider(){
|
|||
* limit is 100 to prevent infinity loop deadlock.
|
||||
*
|
||||
*
|
||||
* If you want to be notified whenever {@link angular.module.NG.$rootScope.Scope#$digest $digest} is called,
|
||||
* If you want to be notified whenever {@link angular.module.ng.$rootScope.Scope#$digest $digest} is called,
|
||||
* you can register an `watchExpression` function with no `listener`. (Since `watchExpression`,
|
||||
* can execute multiple times per {@link angular.module.NG.$rootScope.Scope#$digest $digest} cycle when a change is
|
||||
* can execute multiple times per {@link angular.module.ng.$rootScope.Scope#$digest $digest} cycle when a change is
|
||||
* detected, be prepared for multiple calls to your listener.)
|
||||
*
|
||||
*
|
||||
* # Example
|
||||
<pre>
|
||||
var scope = angular.module.NG.$rootScope.Scope();
|
||||
var scope = angular.module.ng.$rootScope.Scope();
|
||||
scope.name = 'misko';
|
||||
scope.counter = 0;
|
||||
|
||||
|
|
@ -224,7 +224,7 @@ function $RootScopeProvider(){
|
|||
*
|
||||
*
|
||||
* @param {(function()|string)} watchExpression Expression that is evaluated on each
|
||||
* {@link angular.module.NG.$rootScope.Scope#$digest $digest} cycle. A change in the return value triggers a
|
||||
* {@link angular.module.ng.$rootScope.Scope#$digest $digest} cycle. A change in the return value triggers a
|
||||
* call to the `listener`.
|
||||
*
|
||||
* - `string`: Evaluated as {@link guide/dev_guide.expressions expression}
|
||||
|
|
@ -263,24 +263,24 @@ function $RootScopeProvider(){
|
|||
|
||||
/**
|
||||
* @ngdoc function
|
||||
* @name angular.module.NG.$rootScope.Scope#$digest
|
||||
* @methodOf angular.module.NG.$rootScope.Scope
|
||||
* @name angular.module.ng.$rootScope.Scope#$digest
|
||||
* @methodOf angular.module.ng.$rootScope.Scope
|
||||
* @function
|
||||
*
|
||||
* @description
|
||||
* Process all of the {@link angular.module.NG.$rootScope.Scope#$watch watchers} of the current scope and its children.
|
||||
* Because a {@link angular.module.NG.$rootScope.Scope#$watch watcher}'s listener can change the model, the
|
||||
* `$digest()` keeps calling the {@link angular.module.NG.$rootScope.Scope#$watch watchers} until no more listeners are
|
||||
* Process all of the {@link angular.module.ng.$rootScope.Scope#$watch watchers} of the current scope and its children.
|
||||
* Because a {@link angular.module.ng.$rootScope.Scope#$watch watcher}'s listener can change the model, the
|
||||
* `$digest()` keeps calling the {@link angular.module.ng.$rootScope.Scope#$watch watchers} until no more listeners are
|
||||
* firing. This means that it is possible to get into an infinite loop. This function will throw
|
||||
* `'Maximum iteration limit exceeded.'` if the number of iterations exceeds 100.
|
||||
*
|
||||
* Usually you don't call `$digest()` directly in
|
||||
* {@link angular.directive.ng:controller controllers} or in {@link angular.directive directives}.
|
||||
* Instead a call to {@link angular.module.NG.$rootScope.Scope#$apply $apply()} (typically from within a
|
||||
* Instead a call to {@link angular.module.ng.$rootScope.Scope#$apply $apply()} (typically from within a
|
||||
* {@link angular.directive directive}) will force a `$digest()`.
|
||||
*
|
||||
* If you want to be notified whenever `$digest()` is called,
|
||||
* you can register a `watchExpression` function with {@link angular.module.NG.$rootScope.Scope#$watch $watch()}
|
||||
* you can register a `watchExpression` function with {@link angular.module.ng.$rootScope.Scope#$watch $watch()}
|
||||
* with no `listener`.
|
||||
*
|
||||
* You may have a need to call `$digest()` from within unit-tests, to simulate the scope
|
||||
|
|
@ -382,17 +382,17 @@ function $RootScopeProvider(){
|
|||
|
||||
/**
|
||||
* @ngdoc function
|
||||
* @name angular.module.NG.$rootScope.Scope#$destroy
|
||||
* @methodOf angular.module.NG.$rootScope.Scope
|
||||
* @name angular.module.ng.$rootScope.Scope#$destroy
|
||||
* @methodOf angular.module.ng.$rootScope.Scope
|
||||
* @function
|
||||
*
|
||||
* @description
|
||||
* Remove the current scope (and all of its children) from the parent scope. Removal implies
|
||||
* that calls to {@link angular.module.NG.$rootScope.Scope#$digest $digest()} will no longer propagate to the current
|
||||
* that calls to {@link angular.module.ng.$rootScope.Scope#$digest $digest()} will no longer propagate to the current
|
||||
* scope and its children. Removal also implies that the current scope is eligible for garbage
|
||||
* collection.
|
||||
*
|
||||
* The destructing scope emits an `$destroy` {@link angular.module.NG.$rootScope.Scope#$emit event}.
|
||||
* The destructing scope emits an `$destroy` {@link angular.module.ng.$rootScope.Scope#$emit event}.
|
||||
*
|
||||
* The `$destroy()` is usually used by directives such as
|
||||
* {@link angular.widget.@ng:repeat ng:repeat} for managing the unrolling of the loop.
|
||||
|
|
@ -411,8 +411,8 @@ function $RootScopeProvider(){
|
|||
|
||||
/**
|
||||
* @ngdoc function
|
||||
* @name angular.module.NG.$rootScope.Scope#$eval
|
||||
* @methodOf angular.module.NG.$rootScope.Scope
|
||||
* @name angular.module.ng.$rootScope.Scope#$eval
|
||||
* @methodOf angular.module.ng.$rootScope.Scope
|
||||
* @function
|
||||
*
|
||||
* @description
|
||||
|
|
@ -421,7 +421,7 @@ function $RootScopeProvider(){
|
|||
*
|
||||
* # Example
|
||||
<pre>
|
||||
var scope = angular.module.NG.$rootScope.Scope();
|
||||
var scope = angular.module.ng.$rootScope.Scope();
|
||||
scope.a = 1;
|
||||
scope.b = 2;
|
||||
|
||||
|
|
@ -442,8 +442,8 @@ function $RootScopeProvider(){
|
|||
|
||||
/**
|
||||
* @ngdoc function
|
||||
* @name angular.module.NG.$rootScope.Scope#$evalAsync
|
||||
* @methodOf angular.module.NG.$rootScope.Scope
|
||||
* @name angular.module.ng.$rootScope.Scope#$evalAsync
|
||||
* @methodOf angular.module.ng.$rootScope.Scope
|
||||
* @function
|
||||
*
|
||||
* @description
|
||||
|
|
@ -452,11 +452,11 @@ function $RootScopeProvider(){
|
|||
* The `$evalAsync` makes no guarantees as to when the `expression` will be executed, only that:
|
||||
*
|
||||
* - it will execute in the current script execution context (before any DOM rendering).
|
||||
* - at least one {@link angular.module.NG.$rootScope.Scope#$digest $digest cycle} will be performed after
|
||||
* - at least one {@link angular.module.ng.$rootScope.Scope#$digest $digest cycle} will be performed after
|
||||
* `expression` execution.
|
||||
*
|
||||
* Any exceptions from the execution of the expression are forwarded to the
|
||||
* {@link angular.module.NG.$exceptionHandler $exceptionHandler} service.
|
||||
* {@link angular.module.ng.$exceptionHandler $exceptionHandler} service.
|
||||
*
|
||||
* @param {(string|function())=} expression An angular expression to be executed.
|
||||
*
|
||||
|
|
@ -470,16 +470,16 @@ function $RootScopeProvider(){
|
|||
|
||||
/**
|
||||
* @ngdoc function
|
||||
* @name angular.module.NG.$rootScope.Scope#$apply
|
||||
* @methodOf angular.module.NG.$rootScope.Scope
|
||||
* @name angular.module.ng.$rootScope.Scope#$apply
|
||||
* @methodOf angular.module.ng.$rootScope.Scope
|
||||
* @function
|
||||
*
|
||||
* @description
|
||||
* `$apply()` 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 {@link angular.module.NG.$exceptionHandler exception handling},
|
||||
* {@link angular.module.NG.$rootScope.Scope#$digest executing watches}.
|
||||
* of {@link angular.module.ng.$exceptionHandler exception handling},
|
||||
* {@link angular.module.ng.$rootScope.Scope#$digest executing watches}.
|
||||
*
|
||||
* ## Life cycle
|
||||
*
|
||||
|
|
@ -498,11 +498,11 @@ function $RootScopeProvider(){
|
|||
* Scope's `$apply()` method transitions through the following stages:
|
||||
*
|
||||
* 1. The {@link guide/dev_guide.expressions expression} is executed using the
|
||||
* {@link angular.module.NG.$rootScope.Scope#$eval $eval()} method.
|
||||
* {@link angular.module.ng.$rootScope.Scope#$eval $eval()} method.
|
||||
* 2. Any exceptions from the execution of the expression are forwarded to the
|
||||
* {@link angular.module.NG.$exceptionHandler $exceptionHandler} service.
|
||||
* 3. The {@link angular.module.NG.$rootScope.Scope#$watch watch} listeners are fired immediately after the expression
|
||||
* was executed using the {@link angular.module.NG.$rootScope.Scope#$digest $digest()} method.
|
||||
* {@link angular.module.ng.$exceptionHandler $exceptionHandler} service.
|
||||
* 3. The {@link angular.module.ng.$rootScope.Scope#$watch watch} listeners are fired immediately after the expression
|
||||
* was executed using the {@link angular.module.ng.$rootScope.Scope#$digest $digest()} method.
|
||||
*
|
||||
*
|
||||
* @param {(string|function())=} exp An angular expression to be executed.
|
||||
|
|
@ -524,12 +524,12 @@ function $RootScopeProvider(){
|
|||
|
||||
/**
|
||||
* @ngdoc function
|
||||
* @name angular.module.NG.$rootScope.Scope#$on
|
||||
* @methodOf angular.module.NG.$rootScope.Scope
|
||||
* @name angular.module.ng.$rootScope.Scope#$on
|
||||
* @methodOf angular.module.ng.$rootScope.Scope
|
||||
* @function
|
||||
*
|
||||
* @description
|
||||
* Listen on events of a given type. See {@link angular.module.NG.$rootScope.Scope#$emit $emit} for discussion of
|
||||
* Listen on events of a given type. See {@link angular.module.ng.$rootScope.Scope#$emit $emit} for discussion of
|
||||
* event life cycle.
|
||||
*
|
||||
* @param {string} name Event name to listen on.
|
||||
|
|
@ -559,21 +559,21 @@ function $RootScopeProvider(){
|
|||
|
||||
/**
|
||||
* @ngdoc function
|
||||
* @name angular.module.NG.$rootScope.Scope#$emit
|
||||
* @methodOf angular.module.NG.$rootScope.Scope
|
||||
* @name angular.module.ng.$rootScope.Scope#$emit
|
||||
* @methodOf angular.module.ng.$rootScope.Scope
|
||||
* @function
|
||||
*
|
||||
* @description
|
||||
* Dispatches an event `name` upwards through the scope hierarchy notifying the
|
||||
* registered {@link angular.module.NG.$rootScope.Scope#$on} listeners.
|
||||
* registered {@link angular.module.ng.$rootScope.Scope#$on} listeners.
|
||||
*
|
||||
* The event life cycle starts at the scope on which `$emit` was called. All
|
||||
* {@link angular.module.NG.$rootScope.Scope#$on listeners} listening for `name` event on this scope get notified.
|
||||
* {@link angular.module.ng.$rootScope.Scope#$on listeners} listening for `name` 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.
|
||||
*
|
||||
* Any exception emmited from the {@link angular.module.NG.$rootScope.Scope#$on listeners} will be passed
|
||||
* onto the {@link angular.module.NG.$exceptionHandler $exceptionHandler} service.
|
||||
* Any exception emmited from the {@link angular.module.ng.$rootScope.Scope#$on listeners} will be passed
|
||||
* onto the {@link angular.module.ng.$exceptionHandler $exceptionHandler} service.
|
||||
*
|
||||
* @param {string} name Event name to emit.
|
||||
* @param {...*} args Optional set of arguments which will be passed onto the event listeners.
|
||||
|
|
@ -610,21 +610,21 @@ function $RootScopeProvider(){
|
|||
|
||||
/**
|
||||
* @ngdoc function
|
||||
* @name angular.module.NG.$rootScope.Scope#$broadcast
|
||||
* @methodOf angular.module.NG.$rootScope.Scope
|
||||
* @name angular.module.ng.$rootScope.Scope#$broadcast
|
||||
* @methodOf angular.module.ng.$rootScope.Scope
|
||||
* @function
|
||||
*
|
||||
* @description
|
||||
* Dispatches an event `name` downwards to all child scopes (and their children) notifying the
|
||||
* registered {@link angular.module.NG.$rootScope.Scope#$on} listeners.
|
||||
* registered {@link angular.module.ng.$rootScope.Scope#$on} listeners.
|
||||
*
|
||||
* The event life cycle starts at the scope on which `$broadcast` was called. All
|
||||
* {@link angular.module.NG.$rootScope.Scope#$on listeners} listening for `name` event on this scope get notified.
|
||||
* {@link angular.module.ng.$rootScope.Scope#$on listeners} listening for `name` 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.
|
||||
*
|
||||
* Any exception emmited from the {@link angular.module.NG.$rootScope.Scope#$on listeners} will be passed
|
||||
* onto the {@link angular.module.NG.$exceptionHandler $exceptionHandler} service.
|
||||
* Any exception emmited from the {@link angular.module.ng.$rootScope.Scope#$on listeners} will be passed
|
||||
* onto the {@link angular.module.ng.$exceptionHandler $exceptionHandler} service.
|
||||
*
|
||||
* @param {string} name Event name to emit.
|
||||
* @param {...*} args Optional set of arguments which will be passed onto the event listeners.
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
/**
|
||||
* @ngdoc object
|
||||
* @name angular.module.NG.$sniffer
|
||||
* @name angular.module.ng.$sniffer
|
||||
* @requires $window
|
||||
*
|
||||
* @property {boolean} history Does the browser support html5 history api ?
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
/**
|
||||
* @ngdoc object
|
||||
* @name angular.module.NG.$window
|
||||
* @name angular.module.ng.$window
|
||||
*
|
||||
* @description
|
||||
* A reference to the browser's `window` object. While `window`
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
/**
|
||||
* @ngdoc object
|
||||
* @name angular.module.NG.$xhr.bulk
|
||||
* @name angular.module.ng.$xhr.bulk
|
||||
* @requires $xhr
|
||||
* @requires $xhr.error
|
||||
* @requires $log
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
/**
|
||||
* @ngdoc object
|
||||
* @name angular.module.NG.$xhr.cache
|
||||
* @name angular.module.ng.$xhr.cache
|
||||
* @function
|
||||
*
|
||||
* @requires $xhr.bulk
|
||||
|
|
@ -11,11 +11,11 @@
|
|||
* @requires $log
|
||||
*
|
||||
* @description
|
||||
* Acts just like the {@link angular.module.NG.$xhr $xhr} service but caches responses for `GET`
|
||||
* Acts just like the {@link angular.module.ng.$xhr $xhr} service but caches responses for `GET`
|
||||
* requests. All cache misses are delegated to the $xhr service.
|
||||
*
|
||||
* @property {function()} delegate Function to delegate all the cache misses to. Defaults to
|
||||
* the {@link angular.module.NG.$xhr $xhr} service.
|
||||
* the {@link angular.module.ng.$xhr $xhr} service.
|
||||
* @property {object} data The hashmap where all cached entries are stored.
|
||||
*
|
||||
* @param {string} method HTTP method.
|
||||
|
|
|
|||
|
|
@ -2,14 +2,14 @@
|
|||
|
||||
/**
|
||||
* @ngdoc object
|
||||
* @name angular.module.NG.$xhr.error
|
||||
* @name angular.module.ng.$xhr.error
|
||||
* @function
|
||||
* @requires $log
|
||||
*
|
||||
* @description
|
||||
* Error handler for {@link angular.module.NG.$xhr $xhr service}. An application can replaces this
|
||||
* Error handler for {@link angular.module.ng.$xhr $xhr service}. An application can replaces this
|
||||
* service with one specific for the application. The default implementation logs the error to
|
||||
* {@link angular.module.NG.$log $log.error}.
|
||||
* {@link angular.module.ng.$log $log.error}.
|
||||
*
|
||||
* @param {Object} request Request object.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
/**
|
||||
* @ngdoc object
|
||||
* @name angular.module.NG.$xhr
|
||||
* @name angular.module.ng.$xhr
|
||||
* @function
|
||||
* @requires $browser $xhr delegates all XHR requests to the `$browser.xhr()`. A mock version
|
||||
* of the $browser exists which allows setting expectations on XHR requests
|
||||
|
|
@ -12,14 +12,14 @@
|
|||
*
|
||||
* @description
|
||||
* Generates an XHR request. The $xhr service delegates all requests to
|
||||
* {@link angular.module.NG.$browser $browser.xhr()} and adds error handling and security features.
|
||||
* {@link angular.module.ng.$browser $browser.xhr()} and adds error handling and security features.
|
||||
* While $xhr service provides nicer api than raw XmlHttpRequest, it is still considered a lower
|
||||
* level api in angular. For a higher level abstraction that utilizes `$xhr`, please check out the
|
||||
* {@link angular.module.NG.$resource $resource} service.
|
||||
* {@link angular.module.ng.$resource $resource} service.
|
||||
*
|
||||
* # Error handling
|
||||
* If no `error callback` is specified, XHR response with response code other then `2xx` will be
|
||||
* delegated to {@link angular.module.NG.$xhr.error $xhr.error}. The `$xhr.error` can intercept the
|
||||
* delegated to {@link angular.module.ng.$xhr.error $xhr.error}. The `$xhr.error` can intercept the
|
||||
* request and process it in application specific way, or resume normal execution by calling the
|
||||
* request `success` method.
|
||||
*
|
||||
|
|
@ -98,7 +98,7 @@
|
|||
*
|
||||
* - {number} code [HTTP status code](http://en.wikipedia.org/wiki/List_of_HTTP_status_codes) of
|
||||
* the response. This will currently always be 200, since all non-200 responses are routed to
|
||||
* {@link angular.module.NG.$xhr.error} service (or custom error callback).
|
||||
* {@link angular.module.ng.$xhr.error} service (or custom error callback).
|
||||
* - {string|Object} response Response object as string or an Object if the response was in JSON
|
||||
* format.
|
||||
* @param {function(number, (string|Object))} error A function to be called if the response code is
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
*
|
||||
* @description
|
||||
* Angular widget that creates a form scope using the
|
||||
* {@link angular.module.NG.$formFactory $formFactory} API. The resulting form scope instance is
|
||||
* {@link angular.module.ng.$formFactory $formFactory} API. The resulting form scope instance is
|
||||
* attached to the DOM element using the jQuery `.data()` method under the `$form` key.
|
||||
* See {@link guide/dev_guide.forms forms} on detailed discussion of forms and widgets.
|
||||
*
|
||||
|
|
|
|||
|
|
@ -617,7 +617,7 @@ var HTML5_INPUTS_TYPES = makeMap(
|
|||
*
|
||||
* The {@link angular.inputType custom angular.inputType}s provide a shorthand for declaring new
|
||||
* inputs. This is a sharthand for text-box based inputs, and there is no need to go through the
|
||||
* full {@link angular.module.NG.$formFactory $formFactory} widget lifecycle.
|
||||
* full {@link angular.module.ng.$formFactory $formFactory} widget lifecycle.
|
||||
*
|
||||
*
|
||||
* @param {string} type Widget types as defined by {@link angular.inputType}. If the
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@
|
|||
* @param {string} src angular expression evaluating to URL. If the source is a string constant,
|
||||
* make sure you wrap it in quotes, e.g. `src="'myPartialTemplate.html'"`.
|
||||
* @param {Scope=} [scope=new_child_scope] optional expression which evaluates to an
|
||||
* instance of angular.module.NG.$rootScope.Scope to set the HTML fragment to.
|
||||
* instance of angular.module.ng.$rootScope.Scope to set the HTML fragment to.
|
||||
* @param {string=} onload Expression to evaluate when a new partial is loaded.
|
||||
*
|
||||
* @example
|
||||
|
|
@ -491,7 +491,7 @@ angularWidget("@ng:non-bindable", noop);
|
|||
*
|
||||
* @description
|
||||
* # Overview
|
||||
* `ng:view` is a widget that complements the {@link angular.module.NG.$route $route} service by
|
||||
* `ng:view` is a widget that complements the {@link angular.module.ng.$route $route} service by
|
||||
* including the rendered template of the current route into the main layout (`index.html`) file.
|
||||
* Every time the current route changes, the included view changes with it according to the
|
||||
* configuration of the `$route` service.
|
||||
|
|
|
|||
52
test/angular-mocksSpec.js
vendored
52
test/angular-mocksSpec.js
vendored
|
|
@ -8,95 +8,95 @@ describe('mocks', function() {
|
|||
}
|
||||
|
||||
it('should look like a Date', function() {
|
||||
var date = new angular.module.NG_MOCK.TzDate(0,0);
|
||||
var date = new angular.module.ngMock.TzDate(0,0);
|
||||
expect(angular.isDate(date)).toBe(true);
|
||||
});
|
||||
|
||||
it('should take millis as constructor argument', function() {
|
||||
expect(new angular.module.NG_MOCK.TzDate(0, 0).getTime()).toBe(0);
|
||||
expect(new angular.module.NG_MOCK.TzDate(0, 1283555108000).getTime()).toBe(1283555108000);
|
||||
expect(new angular.module.ngMock.TzDate(0, 0).getTime()).toBe(0);
|
||||
expect(new angular.module.ngMock.TzDate(0, 1283555108000).getTime()).toBe(1283555108000);
|
||||
});
|
||||
|
||||
it('should take dateString as constructor argument', function() {
|
||||
expect(new angular.module.NG_MOCK.TzDate(0, '1970-01-01T00:00:00.000Z').getTime()).toBe(0);
|
||||
expect(new angular.module.NG_MOCK.TzDate(0, '2010-09-03T23:05:08.023Z').getTime()).toBe(1283555108023);
|
||||
expect(new angular.module.ngMock.TzDate(0, '1970-01-01T00:00:00.000Z').getTime()).toBe(0);
|
||||
expect(new angular.module.ngMock.TzDate(0, '2010-09-03T23:05:08.023Z').getTime()).toBe(1283555108023);
|
||||
});
|
||||
|
||||
|
||||
it('should fake getLocalDateString method', function() {
|
||||
//0 in -3h
|
||||
var t0 = new angular.module.NG_MOCK.TzDate(-3, 0);
|
||||
var t0 = new angular.module.ngMock.TzDate(-3, 0);
|
||||
expect(t0.toLocaleDateString()).toMatch('1970');
|
||||
|
||||
//0 in +0h
|
||||
var t1 = new angular.module.NG_MOCK.TzDate(0, 0);
|
||||
var t1 = new angular.module.ngMock.TzDate(0, 0);
|
||||
expect(t1.toLocaleDateString()).toMatch('1970');
|
||||
|
||||
//0 in +3h
|
||||
var t2 = new angular.module.NG_MOCK.TzDate(3, 0);
|
||||
var t2 = new angular.module.ngMock.TzDate(3, 0);
|
||||
expect(t2.toLocaleDateString()).toMatch('1969');
|
||||
});
|
||||
|
||||
|
||||
it('should fake getHours method', function() {
|
||||
//0 in -3h
|
||||
var t0 = new angular.module.NG_MOCK.TzDate(-3, 0);
|
||||
var t0 = new angular.module.ngMock.TzDate(-3, 0);
|
||||
expect(t0.getHours()).toBe(3);
|
||||
|
||||
//0 in +0h
|
||||
var t1 = new angular.module.NG_MOCK.TzDate(0, 0);
|
||||
var t1 = new angular.module.ngMock.TzDate(0, 0);
|
||||
expect(t1.getHours()).toBe(0);
|
||||
|
||||
//0 in +3h
|
||||
var t2 = new angular.module.NG_MOCK.TzDate(3, 0);
|
||||
var t2 = new angular.module.ngMock.TzDate(3, 0);
|
||||
expect(t2.getHours()).toMatch(21);
|
||||
});
|
||||
|
||||
|
||||
it('should fake getMinutes method', function() {
|
||||
//0:15 in -3h
|
||||
var t0 = new angular.module.NG_MOCK.TzDate(-3, minutes(15));
|
||||
var t0 = new angular.module.ngMock.TzDate(-3, minutes(15));
|
||||
expect(t0.getMinutes()).toBe(15);
|
||||
|
||||
//0:15 in -3.25h
|
||||
var t0a = new angular.module.NG_MOCK.TzDate(-3.25, minutes(15));
|
||||
var t0a = new angular.module.ngMock.TzDate(-3.25, minutes(15));
|
||||
expect(t0a.getMinutes()).toBe(30);
|
||||
|
||||
//0 in +0h
|
||||
var t1 = new angular.module.NG_MOCK.TzDate(0, minutes(0));
|
||||
var t1 = new angular.module.ngMock.TzDate(0, minutes(0));
|
||||
expect(t1.getMinutes()).toBe(0);
|
||||
|
||||
//0:15 in +0h
|
||||
var t1a = new angular.module.NG_MOCK.TzDate(0, minutes(15));
|
||||
var t1a = new angular.module.ngMock.TzDate(0, minutes(15));
|
||||
expect(t1a.getMinutes()).toBe(15);
|
||||
|
||||
//0:15 in +3h
|
||||
var t2 = new angular.module.NG_MOCK.TzDate(3, minutes(15));
|
||||
var t2 = new angular.module.ngMock.TzDate(3, minutes(15));
|
||||
expect(t2.getMinutes()).toMatch(15);
|
||||
|
||||
//0:15 in +3.25h
|
||||
var t2a = new angular.module.NG_MOCK.TzDate(3.25, minutes(15));
|
||||
var t2a = new angular.module.ngMock.TzDate(3.25, minutes(15));
|
||||
expect(t2a.getMinutes()).toMatch(0);
|
||||
});
|
||||
|
||||
|
||||
it('should fake getSeconds method', function() {
|
||||
//0 in -3h
|
||||
var t0 = new angular.module.NG_MOCK.TzDate(-3, 0);
|
||||
var t0 = new angular.module.ngMock.TzDate(-3, 0);
|
||||
expect(t0.getSeconds()).toBe(0);
|
||||
|
||||
//0 in +0h
|
||||
var t1 = new angular.module.NG_MOCK.TzDate(0, 0);
|
||||
var t1 = new angular.module.ngMock.TzDate(0, 0);
|
||||
expect(t1.getSeconds()).toBe(0);
|
||||
|
||||
//0 in +3h
|
||||
var t2 = new angular.module.NG_MOCK.TzDate(3, 0);
|
||||
var t2 = new angular.module.ngMock.TzDate(3, 0);
|
||||
expect(t2.getSeconds()).toMatch(0);
|
||||
});
|
||||
|
||||
|
||||
it('should create a date representing new year in Bratislava', function() {
|
||||
var newYearInBratislava = new angular.module.NG_MOCK.TzDate(-1, '2009-12-31T23:00:00.000Z');
|
||||
var newYearInBratislava = new angular.module.ngMock.TzDate(-1, '2009-12-31T23:00:00.000Z');
|
||||
expect(newYearInBratislava.getTimezoneOffset()).toBe(-60);
|
||||
expect(newYearInBratislava.getFullYear()).toBe(2010);
|
||||
expect(newYearInBratislava.getMonth()).toBe(0);
|
||||
|
|
@ -108,7 +108,7 @@ describe('mocks', function() {
|
|||
|
||||
it('should delegate all the UTC methods to the original UTC Date object', function() {
|
||||
//from when created from string
|
||||
var date1 = new angular.module.NG_MOCK.TzDate(-1, '2009-12-31T23:00:00.000Z');
|
||||
var date1 = new angular.module.ngMock.TzDate(-1, '2009-12-31T23:00:00.000Z');
|
||||
expect(date1.getUTCFullYear()).toBe(2009);
|
||||
expect(date1.getUTCMonth()).toBe(11);
|
||||
expect(date1.getUTCDate()).toBe(31);
|
||||
|
|
@ -118,7 +118,7 @@ describe('mocks', function() {
|
|||
|
||||
|
||||
//from when created from millis
|
||||
var date2 = new angular.module.NG_MOCK.TzDate(-1, date1.getTime());
|
||||
var date2 = new angular.module.ngMock.TzDate(-1, date1.getTime());
|
||||
expect(date2.getUTCFullYear()).toBe(2009);
|
||||
expect(date2.getUTCMonth()).toBe(11);
|
||||
expect(date2.getUTCDate()).toBe(31);
|
||||
|
|
@ -129,7 +129,7 @@ describe('mocks', function() {
|
|||
|
||||
|
||||
it('should throw error when no third param but toString called', function() {
|
||||
expect(function() { new angular.module.NG_MOCK.TzDate(0,0).toString(); }).
|
||||
expect(function() { new angular.module.ngMock.TzDate(0,0).toString(); }).
|
||||
toThrow('Method \'toString\' is not implemented in the TzDate mock');
|
||||
});
|
||||
});
|
||||
|
|
@ -290,8 +290,8 @@ describe('mocks', function() {
|
|||
});
|
||||
|
||||
|
||||
describe('angular.module.NG_MOCK.dump', function(){
|
||||
var d = angular.module.NG_MOCK.dump;
|
||||
describe('angular.module.ngMock.dump', function(){
|
||||
var d = angular.module.ngMock.dump;
|
||||
|
||||
|
||||
it('should serialize primitive types', function(){
|
||||
|
|
|
|||
|
|
@ -150,7 +150,7 @@ describe("markups", function() {
|
|||
it('should bind Text with no Bindings', inject(function($compile) {
|
||||
var $rootScope;
|
||||
function newScope (){
|
||||
return $rootScope = angular.injector('NG')('$rootScope');
|
||||
return $rootScope = angular.injector('ng')('$rootScope');
|
||||
}
|
||||
forEach(['checked', 'disabled', 'multiple', 'readonly', 'selected'], function(name) {
|
||||
var element = $compile('<div ng:' + name + '="some"></div>')(newScope())
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ beforeEach(function() {
|
|||
|
||||
toHaveClass: function(clazz) {
|
||||
this.message = function() {
|
||||
return "Expected '" + angular.module.NG_MOCK.dump(this.actual) + "' to have class '" + clazz + "'.";
|
||||
return "Expected '" + angular.module.ngMock.dump(this.actual) + "' to have class '" + clazz + "'.";
|
||||
};
|
||||
return this.actual.hasClass ?
|
||||
this.actual.hasClass(clazz) :
|
||||
|
|
|
|||
|
|
@ -46,8 +46,8 @@ describe('angular.scenario.Runner', function() {
|
|||
runner.createSpecRunner_ = function(scope) {
|
||||
return scope.$new(MockSpecRunner);
|
||||
};
|
||||
runner.on('SpecError', angular.module.NG_MOCK.rethrow);
|
||||
runner.on('StepError', angular.module.NG_MOCK.rethrow);
|
||||
runner.on('SpecError', angular.module.ngMock.rethrow);
|
||||
runner.on('StepError', angular.module.ngMock.rethrow);
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
describe('$cookies', function() {
|
||||
beforeEach(inject(function($provide) {
|
||||
$provide.factory('$browser', function(){
|
||||
return angular.extend(new angular.module.NG_MOCK.$Browser(), {cookieHash: {preexisting:'oldCookie'}});
|
||||
return angular.extend(new angular.module.ngMock.$Browser(), {cookieHash: {preexisting:'oldCookie'}});
|
||||
});
|
||||
}));
|
||||
|
||||
|
|
|
|||
|
|
@ -187,10 +187,10 @@ describe('filters', function() {
|
|||
|
||||
describe('date', function() {
|
||||
|
||||
var morning = new angular.module.NG_MOCK.TzDate(+5, '2010-09-03T12:05:08.000Z'); //7am
|
||||
var noon = new angular.module.NG_MOCK.TzDate(+5, '2010-09-03T17:05:08.000Z'); //12pm
|
||||
var midnight = new angular.module.NG_MOCK.TzDate(+5, '2010-09-03T05:05:08.000Z'); //12am
|
||||
var earlyDate = new angular.module.NG_MOCK.TzDate(+5, '0001-09-03T05:05:08.000Z');
|
||||
var morning = new angular.module.ngMock.TzDate(+5, '2010-09-03T12:05:08.000Z'); //7am
|
||||
var noon = new angular.module.ngMock.TzDate(+5, '2010-09-03T17:05:08.000Z'); //12pm
|
||||
var midnight = new angular.module.ngMock.TzDate(+5, '2010-09-03T05:05:08.000Z'); //12am
|
||||
var earlyDate = new angular.module.ngMock.TzDate(+5, '0001-09-03T05:05:08.000Z');
|
||||
|
||||
var date;
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ describe('$log', function() {
|
|||
$window = {};
|
||||
logger = '';
|
||||
$provide.service('$log', $LogProvider);
|
||||
$provide.value('$exceptionHandler', angular.module.NG_MOCK.rethrow);
|
||||
$provide.value('$exceptionHandler', angular.module.ngMock.rethrow);
|
||||
$provide.value('$window', $window);
|
||||
}));
|
||||
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue