@angular-wave/angular.ts 0.0.63 → 0.0.64
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Makefile +6 -2
- package/dist/angular-ts.esm.js +2 -2
- package/dist/angular-ts.umd.js +2 -2
- package/package.json +1 -1
- package/src/angular.spec.js +13 -18
- package/src/animations/module.js +2 -2
- package/src/binding.spec.js +6 -3
- package/src/core/animate/animate.spec.js +1 -3
- package/src/core/cache/cache-factory.spec.js +2 -2
- package/src/core/compile/compile.spec.js +64 -57
- package/src/core/controller/controller.spec.js +2 -2
- package/src/core/cookie-reader.spec.js +2 -2
- package/src/core/filter/filter.spec.js +4 -4
- package/src/core/interpolate/interpolate.spec.js +2 -2
- package/src/core/interval/interval.spec.js +10 -7
- package/src/core/location/location.spec.js +2 -2
- package/src/core/ng-module.js +167 -0
- package/src/core/on.spec.js +2 -2
- package/src/core/parser/lexer.spec.js +11 -8
- package/src/core/parser/parse.spec.js +11 -8
- package/src/core/prop.spec.js +47 -35
- package/src/core/q/q.spec.js +6 -6
- package/src/core/root-element.spec.js +0 -2
- package/src/core/sce/sce.spec.js +7 -6
- package/src/core/scope/scope.spec.js +11 -8
- package/src/core/timeout/timeout.spec.js +10 -7
- package/src/directive/attrs/attrs.spec.js +4 -3
- package/src/directive/attrs/boolean.spec.js +2 -2
- package/src/directive/attrs/element-style.spec.js +4 -3
- package/src/directive/attrs/src.spec.js +7 -5
- package/src/directive/bind/bind.spec.js +10 -7
- package/src/directive/bind/bing-html.spec.js +2 -2
- package/src/directive/change/change.spec.js +2 -2
- package/src/directive/class/class.spec.js +2 -2
- package/src/directive/cloak/cloak.spec.js +2 -2
- package/src/directive/controller/controller.spec.js +2 -3
- package/src/directive/events/click.spec.js +2 -2
- package/src/directive/events/event.spec.js +16 -13
- package/src/directive/form/form.spec.js +11 -9
- package/src/directive/if/if.spec.js +2 -3
- package/src/directive/include/include.spec.js +11 -10
- package/src/directive/init/init.spec.js +2 -3
- package/src/directive/input/input.spec.js +10 -7
- package/src/directive/list/list.spec.js +2 -2
- package/src/directive/model/model.spec.js +11 -11
- package/src/directive/model-options/model-options.spec.js +11 -9
- package/src/directive/non-bindable/non-bindable.spec.js +10 -7
- package/src/directive/options/options.spec.js +10 -7
- package/src/directive/ref/href.spec.js +11 -8
- package/src/directive/ref/ref.spec.js +10 -7
- package/src/directive/repeat/repeat.spec.js +11 -10
- package/src/directive/script/script.spec.js +4 -3
- package/src/directive/select/select.spec.js +10 -7
- package/src/directive/show-hide/show-hide.spec.js +4 -3
- package/src/directive/style/style.spec.js +9 -6
- package/src/directive/switch/switch.spec.js +2 -2
- package/src/directive/validators/validators.spec.js +12 -9
- package/src/exts/aria/aria.js +2 -2
- package/src/exts/aria/aria.spec.js +2 -2
- package/src/exts/messages/messages.js +2 -2
- package/src/exts/messages/messages.spec.js +2 -2
- package/src/filters/filter.spec.js +4 -3
- package/src/filters/filters.spec.js +4 -3
- package/src/filters/limit-to.spec.js +4 -3
- package/src/filters/order-by.spec.js +7 -5
- package/src/index.js +2 -8
- package/src/injector.spec.js +26 -29
- package/src/loader.js +106 -538
- package/src/loader.md +142 -0
- package/src/loader.spec.js +5 -9
- package/src/public.js +113 -107
- package/src/public.spec.js +2 -4
- package/src/router/directives/state-directives.spec.js +0 -3
- package/src/router/directives/view-directive.spec.js +0 -6
- package/src/router/index.js +2 -2
- package/src/router/services.spec.js +0 -2
- package/src/router/state/state.spec.js +2 -4
- package/src/router/state-filter.spec.js +0 -2
- package/src/router/template-factory.spec.js +0 -2
- package/src/router/url/url-service.spec.js +0 -2
- package/src/router/view/view.spec.js +1 -2
- package/src/router/view-hook.spec.js +0 -2
- package/src/router/view-scroll.spec.js +0 -3
- package/src/services/http/http.spec.js +2 -2
- package/src/services/http/template-request.spec.js +3 -3
- package/src/services/http-backend/http-backend.spec.js +3 -2
- package/src/shared/jqlite/jqlite.spec.js +3 -4
- package/src/shared/test-utils.js +1 -1
- package/types/animations/module.d.ts +1 -1
- package/types/core/ng-module.d.ts +57 -0
- package/types/exts/aria/aria.d.ts +1 -1
- package/types/exts/messages/messages.d.ts +1 -1
- package/types/index.d.ts +0 -3
- package/types/loader.d.ts +53 -179
- package/types/public.d.ts +6 -1
- package/types/router/index.d.ts +1 -1
- package/types/shared/test-utils.d.ts +3 -2
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { dealoc } from "../shared/jqlite/jqlite";
|
|
2
2
|
import { Angular } from "../loader";
|
|
3
|
-
import { publishExternalAPI } from "../public";
|
|
4
3
|
import { wait } from "../shared/test-utils";
|
|
5
4
|
|
|
6
5
|
describe("ngView", () => {
|
|
@@ -10,7 +9,6 @@ describe("ngView", () => {
|
|
|
10
9
|
beforeEach(() => {
|
|
11
10
|
dealoc(document.getElementById("dummy"));
|
|
12
11
|
window.angular = new Angular();
|
|
13
|
-
publishExternalAPI();
|
|
14
12
|
window.angular.module("defaultModule", ["ng.router"]);
|
|
15
13
|
let $injector = window.angular.bootstrap(
|
|
16
14
|
document.getElementById("dummy"),
|
|
@@ -48,7 +46,6 @@ describe("ngView", () => {
|
|
|
48
46
|
beforeEach(() => {
|
|
49
47
|
dealoc(document.getElementById("dummy"));
|
|
50
48
|
window.angular = new Angular();
|
|
51
|
-
publishExternalAPI();
|
|
52
49
|
let module = window.angular.module("defaultModule", ["ng.router"]);
|
|
53
50
|
module.config(($provide, $ngViewScrollProvider) => {
|
|
54
51
|
$provide.decorator("$anchorScroll", function ($delegate) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createInjector } from "../../injector";
|
|
2
2
|
import { isObject } from "../../shared/utils";
|
|
3
|
-
import {
|
|
3
|
+
import { Angular } from "../../loader";
|
|
4
4
|
|
|
5
5
|
export function getLastAjaxRequest() {
|
|
6
6
|
let ajaxEntries = performance
|
|
@@ -13,7 +13,7 @@ describe("$http", function () {
|
|
|
13
13
|
let $http, $injector, $httpBackend, requests, response, $rootScope, $q;
|
|
14
14
|
|
|
15
15
|
beforeEach(function () {
|
|
16
|
-
|
|
16
|
+
window.angular = new Angular();
|
|
17
17
|
requests = [];
|
|
18
18
|
$injector = createInjector(["ng"]);
|
|
19
19
|
$http = $injector.get("$http");
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { createInjector } from "../../injector";
|
|
2
|
-
import {
|
|
2
|
+
import { Angular } from "../../loader";
|
|
3
3
|
|
|
4
4
|
describe("$templateRequest", () => {
|
|
5
|
-
let module, $rootScope, $templateRequest, $templateCache, $sce;
|
|
5
|
+
let module, $rootScope, $templateRequest, $templateCache, $sce, angular;
|
|
6
6
|
|
|
7
7
|
beforeEach(() => {
|
|
8
|
-
|
|
8
|
+
angular = window.angular = new Angular();
|
|
9
9
|
module = angular.module("test", ["ng"]);
|
|
10
10
|
let injector = createInjector(["test"]);
|
|
11
11
|
$rootScope = injector.get("$rootScope");
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createInjector } from "../../injector";
|
|
2
|
-
import {
|
|
2
|
+
import { Angular } from "../../loader";
|
|
3
3
|
import { createHttpBackend } from "./http-backend";
|
|
4
4
|
import sinon from "sinon";
|
|
5
5
|
|
|
@@ -9,6 +9,7 @@ describe("$httpBackend", () => {
|
|
|
9
9
|
let xhr;
|
|
10
10
|
let callback;
|
|
11
11
|
let requests;
|
|
12
|
+
let angular;
|
|
12
13
|
|
|
13
14
|
beforeEach(() => {
|
|
14
15
|
xhr = sinon.useFakeXMLHttpRequest();
|
|
@@ -16,7 +17,7 @@ describe("$httpBackend", () => {
|
|
|
16
17
|
xhr.onCreate = function (req) {
|
|
17
18
|
requests.push(req);
|
|
18
19
|
};
|
|
19
|
-
|
|
20
|
+
angular = window.angular = new Angular();
|
|
20
21
|
let $injector = createInjector(["ng"]);
|
|
21
22
|
$browser = $injector.get("$browser");
|
|
22
23
|
xhr = sinon.useFakeXMLHttpRequest();
|
|
@@ -6,9 +6,8 @@ import {
|
|
|
6
6
|
getOrSetCacheData,
|
|
7
7
|
removeElementData,
|
|
8
8
|
} from "./jqlite";
|
|
9
|
-
import {
|
|
9
|
+
import { Angular } from "../../loader";
|
|
10
10
|
import { createInjector } from "../../injector";
|
|
11
|
-
import { publishExternalAPI } from "../../public";
|
|
12
11
|
import { equals, forEach } from "../../shared/utils";
|
|
13
12
|
import { browserTrigger } from "../../shared/test-utils";
|
|
14
13
|
import { CACHE, EXPANDO } from "../../core/cache/cache";
|
|
@@ -27,7 +26,7 @@ describe("jqLite", () => {
|
|
|
27
26
|
});
|
|
28
27
|
|
|
29
28
|
beforeEach(() => {
|
|
30
|
-
|
|
29
|
+
window.angular = new Angular();
|
|
31
30
|
injector = createInjector(["ng"]);
|
|
32
31
|
scope = injector.get("$rootScope");
|
|
33
32
|
jasmine.addMatchers({
|
|
@@ -363,7 +362,7 @@ describe("jqLite", () => {
|
|
|
363
362
|
it("should retrieve injector attached to the current element or its parent", () => {
|
|
364
363
|
const template = JQLite("<div><span></span></div>");
|
|
365
364
|
const span = template.children().eq(0);
|
|
366
|
-
const injector =
|
|
365
|
+
const injector = window.angular.init(template[0]);
|
|
367
366
|
|
|
368
367
|
expect(span.injector()).toBe(injector);
|
|
369
368
|
dealoc(template);
|
package/src/shared/test-utils.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export function initAnimateModule(): void;
|
|
1
|
+
export function initAnimateModule(angular: any): void;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export class NgModule {
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
* @param {String} name - Name of the module
|
|
5
|
+
* @param {Array<String>} requires - List of modules which the injector will load before the current module
|
|
6
|
+
* @param {Function} [configFn]
|
|
7
|
+
*/
|
|
8
|
+
constructor(name: string, requires: Array<string>, configFn?: Function);
|
|
9
|
+
/**
|
|
10
|
+
* @type {string}
|
|
11
|
+
* Name of the module.
|
|
12
|
+
*/
|
|
13
|
+
name: string;
|
|
14
|
+
/**
|
|
15
|
+
* Holds the list of modules which the injector will load before the current module is
|
|
16
|
+
* loaded.
|
|
17
|
+
*/
|
|
18
|
+
requires: string[];
|
|
19
|
+
configFn: Function;
|
|
20
|
+
/** @type {!Array.<Array.<*>>} */
|
|
21
|
+
_invokeQueue: Array<Array<any>>;
|
|
22
|
+
/** @type {!Array.<any>} */
|
|
23
|
+
_configBlocks: Array<any>;
|
|
24
|
+
/** @type {!Array.<Function>} */
|
|
25
|
+
_runBlocks: Array<Function>;
|
|
26
|
+
/** @type {Object} */
|
|
27
|
+
infoState: any;
|
|
28
|
+
/**
|
|
29
|
+
*
|
|
30
|
+
* @param {Object} value
|
|
31
|
+
* @returns
|
|
32
|
+
*/
|
|
33
|
+
info(value: any): any;
|
|
34
|
+
/**
|
|
35
|
+
* @param {String} name
|
|
36
|
+
* @param {any} object
|
|
37
|
+
* @returns {NgModule}
|
|
38
|
+
*/
|
|
39
|
+
value(name: string, object: any): NgModule;
|
|
40
|
+
/**
|
|
41
|
+
* @param {String} name
|
|
42
|
+
* @param {any} object
|
|
43
|
+
* @returns {NgModule}
|
|
44
|
+
*/
|
|
45
|
+
constant(name: string, object: any): NgModule;
|
|
46
|
+
config(configFn: any): this;
|
|
47
|
+
run(block: any): this;
|
|
48
|
+
component(name: any, options: any): this;
|
|
49
|
+
factory(name: any, providerFunction: any): this;
|
|
50
|
+
service(name: any, serviceFunction: any): this;
|
|
51
|
+
provider(name: any, providerType: any): this;
|
|
52
|
+
decorator(name: any, decorFn: any): this;
|
|
53
|
+
directive(name: any, directiveFactory: any): this;
|
|
54
|
+
animation(name: any, animationFactory: any): this;
|
|
55
|
+
filter(name: any, filterFn: any): this;
|
|
56
|
+
controller(name: any, ctlFn: any): this;
|
|
57
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export function initAriaModule(): void;
|
|
1
|
+
export function initAriaModule(angular: any): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export function initMessageModule(): void;
|
|
1
|
+
export function initMessageModule(angular: any): void;
|
package/types/index.d.ts
CHANGED
package/types/loader.d.ts
CHANGED
|
@@ -1,170 +1,9 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @ngdoc directive
|
|
3
|
-
* @name ngApp
|
|
4
|
-
*
|
|
5
|
-
* @element ANY
|
|
6
|
-
* @param {import('./types').Module} ngApp an optional application
|
|
7
|
-
* {@link angular.module module} name to load.
|
|
8
|
-
* @param {boolean=} ngStrictDi if this attribute is present on the app element, the injector will be
|
|
9
|
-
* created in "strict-di" mode. This means that the application will fail to invoke functions which
|
|
10
|
-
* do not use explicit function annotation (and are thus unsuitable for minification), as described
|
|
11
|
-
* in {@link guide/di the Dependency Injection guide}, and useful debugging info will assist in
|
|
12
|
-
* tracking down the root of these bugs.
|
|
13
|
-
*
|
|
14
|
-
* @description
|
|
15
|
-
*
|
|
16
|
-
* Use this directive to **auto-bootstrap** an AngularJS application. The `ngApp` directive
|
|
17
|
-
* designates the **root element** of the application and is typically placed near the root element
|
|
18
|
-
* of the page - e.g. on the `<body>` or `<html>` tags.
|
|
19
|
-
*
|
|
20
|
-
* There are a few things to keep in mind when using `ngApp`:
|
|
21
|
-
* - only one AngularJS application can be auto-bootstrapped per HTML document. The first `ngApp`
|
|
22
|
-
* found in the document will be used to define the root element to auto-bootstrap as an
|
|
23
|
-
* application. To run multiple applications in an HTML document you must manually bootstrap them using
|
|
24
|
-
* {@link angular.bootstrap} instead.
|
|
25
|
-
* - AngularJS applications cannot be nested within each other.
|
|
26
|
-
* - Do not use a directive that uses {@link ng.$compile#transclusion transclusion} on the same element as `ngApp`.
|
|
27
|
-
* This includes directives such as {@link ng.ngIf `ngIf`}, {@link ng.ngInclude `ngInclude`} and
|
|
28
|
-
* {@link ngRoute.ngView `ngView`}.
|
|
29
|
-
* Doing this misplaces the app {@link ng.$rootElement `$rootElement`} and the app's {@link auto.$injector injector},
|
|
30
|
-
* causing animations to stop working and making the injector inaccessible from outside the app.
|
|
31
|
-
*
|
|
32
|
-
* You can specify an **AngularJS module** to be used as the root module for the application. This
|
|
33
|
-
* module will be loaded into the {@link auto.$injector} when the application is bootstrapped. It
|
|
34
|
-
* should contain the application code needed or have dependencies on other modules that will
|
|
35
|
-
* contain the code. See {@link angular.module} for more information.
|
|
36
|
-
*
|
|
37
|
-
* In the example below if the `ngApp` directive were not placed on the `html` element then the
|
|
38
|
-
* document would not be compiled, the `AppController` would not be instantiated and the `{{ a+b }}`
|
|
39
|
-
* would not be resolved to `3`.
|
|
40
|
-
*
|
|
41
|
-
* @example
|
|
42
|
-
*
|
|
43
|
-
* ### Simple Usage
|
|
44
|
-
*
|
|
45
|
-
* `ngApp` is the easiest, and most common way to bootstrap an application.
|
|
46
|
-
*
|
|
47
|
-
<example module="ngAppDemo" name="ng-app">
|
|
48
|
-
<file name="index.html">
|
|
49
|
-
<div ng-controller="ngAppDemoController">
|
|
50
|
-
I can add: {{a}} + {{b}} = {{ a+b }}
|
|
51
|
-
</div>
|
|
52
|
-
</file>
|
|
53
|
-
<file name="script.js">
|
|
54
|
-
angular.module('ngAppDemo', []).controller('ngAppDemoController', function($scope) {
|
|
55
|
-
$scope.a = 1;
|
|
56
|
-
$scope.b = 2;
|
|
57
|
-
});
|
|
58
|
-
</file>
|
|
59
|
-
</example>
|
|
60
|
-
*
|
|
61
|
-
* @example
|
|
62
|
-
*
|
|
63
|
-
* ### With `ngStrictDi`
|
|
64
|
-
*
|
|
65
|
-
* Using `ngStrictDi`, you would see something like this:
|
|
66
|
-
*
|
|
67
|
-
<example ng-app-included="true" name="strict-di">
|
|
68
|
-
<file name="index.html">
|
|
69
|
-
<div ng-app="ngAppStrictDemo" ng-strict-di>
|
|
70
|
-
<div ng-controller="GoodController1">
|
|
71
|
-
I can add: {{a}} + {{b}} = {{ a+b }}
|
|
72
|
-
|
|
73
|
-
<p>This renders because the controller does not fail to
|
|
74
|
-
instantiate, by using explicit annotation style (see
|
|
75
|
-
script.js for details)
|
|
76
|
-
</p>
|
|
77
|
-
</div>
|
|
78
|
-
|
|
79
|
-
<div ng-controller="GoodController2">
|
|
80
|
-
Name: <input ng-model="name"><br />
|
|
81
|
-
Hello, {{name}}!
|
|
82
|
-
|
|
83
|
-
<p>This renders because the controller does not fail to
|
|
84
|
-
instantiate, by using explicit annotation style
|
|
85
|
-
(see script.js for details)
|
|
86
|
-
</p>
|
|
87
|
-
</div>
|
|
88
|
-
|
|
89
|
-
<div ng-controller="BadController">
|
|
90
|
-
I can add: {{a}} + {{b}} = {{ a+b }}
|
|
91
|
-
|
|
92
|
-
<p>The controller could not be instantiated, due to relying
|
|
93
|
-
on automatic function annotations (which are disabled in
|
|
94
|
-
strict mode). As such, the content of this section is not
|
|
95
|
-
interpolated, and there should be an error in your web console.
|
|
96
|
-
</p>
|
|
97
|
-
</div>
|
|
98
|
-
</div>
|
|
99
|
-
</file>
|
|
100
|
-
<file name="script.js">
|
|
101
|
-
angular.module('ngAppStrictDemo', [])
|
|
102
|
-
// BadController will fail to instantiate, due to relying on automatic function annotation,
|
|
103
|
-
// rather than an explicit annotation
|
|
104
|
-
.controller('BadController', function($scope) {
|
|
105
|
-
$scope.a = 1;
|
|
106
|
-
$scope.b = 2;
|
|
107
|
-
})
|
|
108
|
-
// Unlike BadController, GoodController1 and GoodController2 will not fail to be instantiated,
|
|
109
|
-
// due to using explicit annotations using the array style and $inject property, respectively.
|
|
110
|
-
.controller('GoodController1', ['$scope', function($scope) {
|
|
111
|
-
$scope.a = 1;
|
|
112
|
-
$scope.b = 2;
|
|
113
|
-
}])
|
|
114
|
-
.controller('GoodController2', GoodController2);
|
|
115
|
-
function GoodController2($scope) {
|
|
116
|
-
$scope.name = 'World';
|
|
117
|
-
}
|
|
118
|
-
GoodController2.$inject = ['$scope'];
|
|
119
|
-
</file>
|
|
120
|
-
<file name="style.css">
|
|
121
|
-
div[ng-controller] {
|
|
122
|
-
margin-bottom: 1em;
|
|
123
|
-
-webkit-border-radius: 4px;
|
|
124
|
-
border-radius: 4px;
|
|
125
|
-
border: 1px solid;
|
|
126
|
-
padding: .5em;
|
|
127
|
-
}
|
|
128
|
-
div[ng-controller^=Good] {
|
|
129
|
-
border-color: #d6e9c6;
|
|
130
|
-
background-color: #dff0d8;
|
|
131
|
-
color: #3c763d;
|
|
132
|
-
}
|
|
133
|
-
div[ng-controller^=Bad] {
|
|
134
|
-
border-color: #ebccd1;
|
|
135
|
-
background-color: #f2dede;
|
|
136
|
-
color: #a94442;
|
|
137
|
-
margin-bottom: 0;
|
|
138
|
-
}
|
|
139
|
-
</file>
|
|
140
|
-
</example>
|
|
141
|
-
*/
|
|
142
|
-
/**
|
|
143
|
-
* @param {Element|Document} element
|
|
144
|
-
*/
|
|
145
|
-
export function angularInit(element: Element | Document): void;
|
|
146
|
-
/**
|
|
147
|
-
* @ngdoc type
|
|
148
|
-
* @name import('./types').Module
|
|
149
|
-
* @module ng
|
|
150
|
-
* @description
|
|
151
|
-
*
|
|
152
|
-
* Interface for configuring AngularJS {@link angular.module modules}.
|
|
153
|
-
*/
|
|
154
|
-
export function setupModuleLoader(window: any): any;
|
|
155
|
-
/**
|
|
156
|
-
* @type {string} `version` from `package.json`, injected by Rollup plugin
|
|
157
|
-
*/
|
|
158
|
-
export const VERSION: string;
|
|
159
1
|
/**
|
|
160
2
|
* Configuration option for AngularTS bootstrap process.
|
|
161
3
|
*
|
|
162
4
|
* @typedef {Object} AngularBootstrapConfig
|
|
163
5
|
* @property {boolean} [strictDi] - Disable automatic function annotation for the application. This is meant to assist in finding bugs which break minified code. Defaults to `false`.
|
|
164
6
|
*/
|
|
165
|
-
/**
|
|
166
|
-
* @class
|
|
167
|
-
*/
|
|
168
7
|
export class Angular {
|
|
169
8
|
/** @type {Map<number, import("./core/cache/cache").ExpandoStore>} */
|
|
170
9
|
cache: Map<number, import("./core/cache/cache").ExpandoStore>;
|
|
@@ -189,18 +28,11 @@ export class Angular {
|
|
|
189
28
|
/**
|
|
190
29
|
* Use this function to manually start up AngularJS application.
|
|
191
30
|
*
|
|
192
|
-
* For more information, see the {@link guide/bootstrap Bootstrap guide}.
|
|
193
|
-
*
|
|
194
31
|
* AngularJS will detect if it has been loaded into the browser more than once and only allow the
|
|
195
32
|
* first loaded script to be bootstrapped and will report a warning to the browser console for
|
|
196
33
|
* each of the subsequent scripts. This prevents strange results in applications, where otherwise
|
|
197
34
|
* multiple instances of AngularJS try to work on the DOM.
|
|
198
|
-
*
|
|
199
|
-
* <div class="alert alert-warning">
|
|
200
|
-
* **Note:** Protractor based end-to-end tests cannot use this function to bootstrap manually.
|
|
201
|
-
* They must use {@link ng.directive:ngApp ngApp}.
|
|
202
|
-
* </div>
|
|
203
|
-
*
|
|
35
|
+
* *
|
|
204
36
|
* <div class="alert alert-warning">
|
|
205
37
|
* **Note:** Do not bootstrap the app on an element with a directive that uses {@link ng.$compile#transclusion transclusion},
|
|
206
38
|
* such as {@link ng.ngIf `ngIf`}, {@link ng.ngInclude `ngInclude`} and {@link ngRoute.ngView `ngView`}.
|
|
@@ -251,16 +83,57 @@ export class Angular {
|
|
|
251
83
|
*/
|
|
252
84
|
injector(modules: any[], strictDi: boolean | null): import("./types").InjectorService;
|
|
253
85
|
/**
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
86
|
+
* @param {Element|Document} element
|
|
87
|
+
*/
|
|
88
|
+
init(element: Element | Document): void;
|
|
89
|
+
/**
|
|
90
|
+
*
|
|
91
|
+
* The `angular.module` is a global place for creating, registering and retrieving AngularJS
|
|
92
|
+
* modules.
|
|
93
|
+
* All modules (AngularJS core or 3rd party) that should be available to an application must be
|
|
94
|
+
* registered using this mechanism.
|
|
95
|
+
*
|
|
96
|
+
* Passing one argument retrieves an existing {@link import('./types').Module},
|
|
97
|
+
* whereas passing more than one argument creates a new {@link import('./types').Module}
|
|
98
|
+
*
|
|
99
|
+
*
|
|
100
|
+
* # Module
|
|
101
|
+
*
|
|
102
|
+
* A module is a collection of services, directives, controllers, filters, and configuration information.
|
|
103
|
+
* `angular.module` is used to configure the {@link auto.$injector $injector}.
|
|
104
|
+
*
|
|
105
|
+
* ```js
|
|
106
|
+
* // Create a new module
|
|
107
|
+
* let myModule = angular.module('myModule', []);
|
|
108
|
+
*
|
|
109
|
+
* // register a new service
|
|
110
|
+
* myModule.value('appName', 'MyCoolApp');
|
|
111
|
+
*
|
|
112
|
+
* // configure existing services inside initialization blocks.
|
|
113
|
+
* myModule.config(['$locationProvider', function($locationProvider) {
|
|
114
|
+
* // Configure existing providers
|
|
115
|
+
* $locationProvider.hashPrefix('!');
|
|
116
|
+
* }]);
|
|
117
|
+
* ```
|
|
118
|
+
*
|
|
119
|
+
* Then you can create an injector and load your modules like this:
|
|
120
|
+
*
|
|
121
|
+
* ```js
|
|
122
|
+
* let injector = angular.injector(['ng', 'myModule'])
|
|
123
|
+
* ```
|
|
124
|
+
*
|
|
125
|
+
* However it's more likely that you'll just use
|
|
126
|
+
* {@link ng.directive:ngApp ngApp} or
|
|
127
|
+
* {@link angular.bootstrap} to simplify this process for you.
|
|
128
|
+
*
|
|
129
|
+
* @param {!string} name The name of the module to create or retrieve.
|
|
130
|
+
* @param {!Array.<string>=} requires If specified then new module is being created. If
|
|
131
|
+
* unspecified then the module is being retrieved for further configuration.
|
|
132
|
+
* @param {Function=} configFn Optional configuration function for the module. Same as
|
|
133
|
+
* {@link import('./types').Module#config Module#config()}.
|
|
134
|
+
* @returns {NgModule} A newly registered module.
|
|
135
|
+
*/
|
|
136
|
+
module(name: string, requires?: Array<string> | undefined, configFn?: Function | undefined): NgModule;
|
|
264
137
|
}
|
|
265
138
|
/**
|
|
266
139
|
* Configuration option for AngularTS bootstrap process.
|
|
@@ -271,3 +144,4 @@ export type AngularBootstrapConfig = {
|
|
|
271
144
|
*/
|
|
272
145
|
strictDi?: boolean;
|
|
273
146
|
};
|
|
147
|
+
import { NgModule } from "./core/ng-module";
|
package/types/public.d.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Initializes `ng`, `animate`, `message`, `aria` and `router` modules.
|
|
3
|
+
* @param {import('./loader').Angular} angular
|
|
3
4
|
* @returns {import('./types').Module} `ng`module
|
|
4
5
|
*/
|
|
5
|
-
export function publishExternalAPI(): import("./types").Module;
|
|
6
|
+
export function publishExternalAPI(angular: import("./loader").Angular): import("./types").Module;
|
|
7
|
+
/**
|
|
8
|
+
* @type {string} `version` from `package.json`, injected by Rollup plugin
|
|
9
|
+
*/
|
|
10
|
+
export const VERSION: string;
|
package/types/router/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export function initRouter(): void;
|
|
1
|
+
export function initRouter(angular: any): void;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @param {HTMLElement} element
|
|
2
|
+
* @param {HTMLElement|JQLite} element
|
|
3
3
|
* @param {string} event
|
|
4
4
|
*/
|
|
5
|
-
export function browserTrigger(element: HTMLElement, event: string): void;
|
|
5
|
+
export function browserTrigger(element: HTMLElement | JQLite, event: string): void;
|
|
6
6
|
/**
|
|
7
7
|
*
|
|
8
8
|
* @param {number} t milliseconds to wait
|
|
9
9
|
* @returns
|
|
10
10
|
*/
|
|
11
11
|
export function wait(t: number): Promise<any>;
|
|
12
|
+
import { JQLite } from "./jqlite/jqlite";
|