@angular-wave/angular.ts 0.0.67 → 0.0.69
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/dist/angular-ts.esm.js +2 -2
- package/dist/angular-ts.umd.js +2 -2
- package/package.json +1 -1
- package/src/animations/animate-swap.js +1 -1
- package/src/core/animate/animate.js +5 -5
- package/src/core/compile/compile.spec.js +2 -2
- package/src/core/controller/controller.js +5 -1
- package/src/core/cookie-reader.spec.js +1 -1
- package/src/core/di/injector.js +1 -1
- package/src/core/di/injector.spec.js +35 -35
- package/src/core/di/internal-injector.js +1 -1
- package/src/core/filter/filter.spec.js +15 -15
- package/src/core/interpolate/interpolate.spec.js +29 -29
- package/src/core/interval/interval-factory.js +8 -1
- package/src/core/interval/interval.js +30 -16
- package/src/core/interval/interval.spec.js +1 -1
- package/src/core/location/location.js +473 -626
- package/src/core/location/location.md +114 -0
- package/src/core/location/location.spec.js +2 -77
- package/src/core/parser/lexer.spec.js +1 -1
- package/src/core/parser/parse.spec.js +1 -1
- package/src/core/q/q.js +64 -65
- package/src/core/q/q.spec.js +1 -1
- package/src/core/sce/sce.js +1 -3
- package/src/core/scope/scope.js +3 -6
- package/src/core/timeout/timeout.js +5 -21
- package/src/core/url-utils/url-utils.js +5 -0
- package/src/directive/attrs/boolean.spec.js +1 -1
- package/src/directive/bind/bind.js +2 -2
- package/src/directive/class/class.js +1 -1
- package/src/directive/form/form.js +1 -18
- package/src/directive/form/form.spec.js +2 -2
- package/src/directive/include/include.js +7 -0
- package/src/directive/input/input.js +1 -1
- package/src/{exts → directive}/messages/messages.html +4 -1
- package/src/directive/messages/messages.js +346 -0
- package/src/{exts → directive}/messages/messages.spec.js +7 -11
- package/src/{exts → directive}/messages/messages.test.js +1 -1
- package/src/directive/model-options/model-options.spec.js +1 -1
- package/src/directive/options/options.js +2 -156
- package/src/directive/options/options.md +179 -0
- package/src/directive/select/select.js +7 -4
- package/src/directive/switch/switch.spec.js +1 -1
- package/src/exts/aria/aria.spec.js +1 -1
- package/src/filters/filter.js +2 -3
- package/src/filters/filter.spec.js +1 -1
- package/src/filters/filters.spec.js +1 -1
- package/src/filters/limit-to.spec.js +2 -2
- package/src/loader.js +1 -1
- package/src/loader.spec.js +1 -1
- package/src/public.js +12 -2
- package/src/router/common/glob.spec.js +1 -1
- package/src/router/params/param-factory.js +1 -1
- package/src/router/params/param.js +54 -54
- package/src/router/path/path-utils.js +1 -0
- package/src/router/state/state-builder.spec.js +1 -1
- package/src/router/template-factory.js +6 -4
- package/src/router/url/url-service.js +7 -0
- package/src/router/view/view.spec.js +8 -11
- package/src/router/view-scroll.js +6 -1
- package/src/services/anchor-scroll.html +83 -0
- package/src/services/anchor-scroll.js +25 -10
- package/src/services/browser.js +1 -1
- package/src/services/http/http.spec.js +40 -40
- package/src/shared/jqlite/jqlite.js +4 -4
- package/src/shared/jqlite/jqlite.spec.js +4 -4
- package/src/shared/utils.js +1 -1
- package/types/core/interval/interval-factory.d.ts +1 -1
- package/types/core/interval/interval.d.ts +4 -0
- package/types/core/location/location.d.ts +235 -166
- package/types/core/q/q.d.ts +66 -40
- package/types/core/scope/scope.d.ts +5 -8
- package/types/core/timeout/timeout.d.ts +3 -7
- package/types/core/url-utils/url-utils.d.ts +4 -0
- package/types/directive/form/form.d.ts +3 -20
- package/types/directive/include/include.d.ts +1 -1
- package/types/router/params/param-factory.d.ts +1 -1
- package/types/router/params/param.d.ts +11 -0
- package/types/router/template-factory.d.ts +4 -4
- package/types/router/url/url-service.d.ts +9 -9
- package/types/router/view-scroll.d.ts +1 -1
- package/types/services/anchor-scroll.d.ts +16 -1
- package/types/services/browser.d.ts +2 -2
- package/types/shared/jqlite/jqlite.d.ts +2 -2
- package/src/exts/messages/messages.js +0 -359
- package/types/exts/messages/messages.d.ts +0 -1
- /package/src/{exts → directive}/messages/messages.md +0 -0
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/\*\*
|
|
2
|
+
|
|
3
|
+
- The $location service parses the URL in the browser address bar (based on the
|
|
4
|
+
- [window.location](https://developer.mozilla.org/en/window.location)) and makes the URL
|
|
5
|
+
- available to your application. Changes to the URL in the address bar are reflected into
|
|
6
|
+
- $location service and changes to $location are reflected into the browser address bar.
|
|
7
|
+
-
|
|
8
|
+
- **The $location service:**
|
|
9
|
+
-
|
|
10
|
+
- - Exposes the current URL in the browser address bar, so you can
|
|
11
|
+
- - Watch and observe the URL.
|
|
12
|
+
- - Change the URL.
|
|
13
|
+
- - Synchronizes the URL with the browser when the user
|
|
14
|
+
- - Changes the address bar.
|
|
15
|
+
- - Clicks the back or forward button (or clicks a History link).
|
|
16
|
+
- - Clicks on a link.
|
|
17
|
+
- - Represents the URL object as a set of methods (protocol, host, port, path, search, hash).
|
|
18
|
+
-
|
|
19
|
+
- For more information see {@link guide/$location Developer Guide: Using $location}
|
|
20
|
+
\*/
|
|
21
|
+
|
|
22
|
+
/\*\*
|
|
23
|
+
|
|
24
|
+
- Use the `$locationProvider` to configure how the application deep linking paths are stored.
|
|
25
|
+
\*/
|
|
26
|
+
|
|
27
|
+
/\*\*
|
|
28
|
+
|
|
29
|
+
- @ngdoc event
|
|
30
|
+
- @name $location#$locationChangeStart
|
|
31
|
+
- @eventType broadcast on root scope
|
|
32
|
+
- @description
|
|
33
|
+
- Broadcasted before a URL will change.
|
|
34
|
+
-
|
|
35
|
+
- This change can be prevented by calling
|
|
36
|
+
- `preventDefault` method of the event. See {@link ng.$rootScope.Scope#$on} for more
|
|
37
|
+
- details about event object. Upon successful change
|
|
38
|
+
- {@link ng.$location#$locationChangeSuccess $locationChangeSuccess} is fired.
|
|
39
|
+
-
|
|
40
|
+
- The `newState` and `oldState` parameters may be defined only in HTML5 mode and when
|
|
41
|
+
- the browser supports the HTML5 History API.
|
|
42
|
+
-
|
|
43
|
+
- @param {Object} angularEvent Synthetic event object.
|
|
44
|
+
- @param {string} newUrl New URL
|
|
45
|
+
- @param {string=} oldUrl URL that was before it was changed.
|
|
46
|
+
- @param {string=} newState New history state object
|
|
47
|
+
- @param {string=} oldState History state object that was before it was changed.
|
|
48
|
+
\*/
|
|
49
|
+
|
|
50
|
+
/\*\*
|
|
51
|
+
|
|
52
|
+
- @ngdoc event
|
|
53
|
+
- @name $location#$locationChangeSuccess
|
|
54
|
+
- @eventType broadcast on root scope
|
|
55
|
+
- @description
|
|
56
|
+
- Broadcasted after a URL was changed.
|
|
57
|
+
-
|
|
58
|
+
- The `newState` and `oldState` parameters may be defined only in HTML5 mode and when
|
|
59
|
+
- the browser supports the HTML5 History API.
|
|
60
|
+
-
|
|
61
|
+
- @param {Object} angularEvent Synthetic event object.
|
|
62
|
+
- @param {string} newUrl New URL
|
|
63
|
+
- @param {string=} oldUrl URL that was before it was changed.
|
|
64
|
+
- @param {string=} newState New history state object
|
|
65
|
+
- @param {string=} oldState History state object that was before it was changed.
|
|
66
|
+
\*/
|
|
67
|
+
|
|
68
|
+
/\*\*
|
|
69
|
+
|
|
70
|
+
- This method is getter / setter.
|
|
71
|
+
-
|
|
72
|
+
- Return search part (as object) of current URL when called without any parameter.
|
|
73
|
+
-
|
|
74
|
+
- Change search part when called with parameter and return `$location`.
|
|
75
|
+
-
|
|
76
|
+
-
|
|
77
|
+
- ```js
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
- // given URL http://example.com/#/some/path?foo=bar&baz=xoxo
|
|
82
|
+
- let searchObject = $location.search();
|
|
83
|
+
- // => {foo: 'bar', baz: 'xoxo'}
|
|
84
|
+
-
|
|
85
|
+
- // set foo to 'yipee'
|
|
86
|
+
- $location.search('foo', 'yipee');
|
|
87
|
+
- // $location.search() => {foo: 'yipee', baz: 'xoxo'}
|
|
88
|
+
- ```
|
|
89
|
+
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
-
|
|
93
|
+
- @param {string|Object} search New search params - string or hash object.
|
|
94
|
+
-
|
|
95
|
+
- When called with a single argument the method acts as a setter, setting the `search` component
|
|
96
|
+
- of `$location` to the specified value.
|
|
97
|
+
-
|
|
98
|
+
- If the argument is a hash object containing an array of values, these values will be encoded
|
|
99
|
+
- as duplicate search parameters in the URL.
|
|
100
|
+
-
|
|
101
|
+
- @param {(string|Number|Array<string>|boolean)=} paramValue If `search` is a string or number, then `paramValue`
|
|
102
|
+
- will override only a single search property.
|
|
103
|
+
-
|
|
104
|
+
- If `paramValue` is an array, it will override the property of the `search` component of
|
|
105
|
+
- `$location` specified via the first argument.
|
|
106
|
+
-
|
|
107
|
+
- If `paramValue` is `null`, the property specified via the first argument will be deleted.
|
|
108
|
+
-
|
|
109
|
+
- If `paramValue` is `true`, the property specified via the first argument will be added with no
|
|
110
|
+
- value nor trailing equal sign.
|
|
111
|
+
-
|
|
112
|
+
- @return {Object} If called with no arguments returns the parsed `search` object. If called with
|
|
113
|
+
- one or more arguments returns `$location` object itself.
|
|
114
|
+
\*/
|
|
@@ -2,10 +2,9 @@ import {
|
|
|
2
2
|
LocationHtml5Url,
|
|
3
3
|
LocationHashbangUrl,
|
|
4
4
|
$LocationProvider,
|
|
5
|
-
LocationHashbangInHtml5Url,
|
|
6
5
|
} from "./location";
|
|
7
6
|
import { Angular } from "../../loader";
|
|
8
|
-
import { createInjector } from "
|
|
7
|
+
import { createInjector } from "../di/injector";
|
|
9
8
|
|
|
10
9
|
describe("$location", () => {
|
|
11
10
|
let module;
|
|
@@ -464,6 +463,7 @@ describe("$location", () => {
|
|
|
464
463
|
.hash("abcd")
|
|
465
464
|
.state({ a: 2 })
|
|
466
465
|
.search("bar", "baz");
|
|
466
|
+
|
|
467
467
|
expect(locationUrl.path()).toEqual("/foo");
|
|
468
468
|
expect(locationUrl.state()).toEqual({ a: 2 });
|
|
469
469
|
expect(locationUrl.search() && locationUrl.search().bar).toBe("baz");
|
|
@@ -3310,81 +3310,6 @@ describe("$location", () => {
|
|
|
3310
3310
|
});
|
|
3311
3311
|
});
|
|
3312
3312
|
|
|
3313
|
-
describe("LocationHashbangInHtml5Url", () => {
|
|
3314
|
-
/* global LocationHashbangInHtml5Url: false */
|
|
3315
|
-
let locationUrl;
|
|
3316
|
-
let locationIndexUrl;
|
|
3317
|
-
|
|
3318
|
-
beforeEach(() => {
|
|
3319
|
-
locationUrl = new LocationHashbangInHtml5Url(
|
|
3320
|
-
"http://server/pre/",
|
|
3321
|
-
"http://server/pre/",
|
|
3322
|
-
"#!",
|
|
3323
|
-
);
|
|
3324
|
-
locationIndexUrl = new LocationHashbangInHtml5Url(
|
|
3325
|
-
"http://server/pre/index.html",
|
|
3326
|
-
"http://server/pre/",
|
|
3327
|
-
"#!",
|
|
3328
|
-
);
|
|
3329
|
-
});
|
|
3330
|
-
|
|
3331
|
-
it("should rewrite URL", () => {
|
|
3332
|
-
expect(parseLinkAndReturn(locationUrl, "http://other")).toEqual(
|
|
3333
|
-
undefined,
|
|
3334
|
-
);
|
|
3335
|
-
expect(parseLinkAndReturn(locationUrl, "http://server/pre")).toEqual(
|
|
3336
|
-
"http://server/pre/#!",
|
|
3337
|
-
);
|
|
3338
|
-
expect(parseLinkAndReturn(locationUrl, "http://server/pre/")).toEqual(
|
|
3339
|
-
"http://server/pre/#!",
|
|
3340
|
-
);
|
|
3341
|
-
expect(
|
|
3342
|
-
parseLinkAndReturn(locationUrl, "http://server/pre/otherPath"),
|
|
3343
|
-
).toEqual("http://server/pre/#!/otherPath");
|
|
3344
|
-
// Note: relies on the previous state!
|
|
3345
|
-
expect(
|
|
3346
|
-
parseLinkAndReturn(locationUrl, "someIgnoredAbsoluteHref", "#test"),
|
|
3347
|
-
).toEqual("http://server/pre/#!/otherPath#test");
|
|
3348
|
-
|
|
3349
|
-
expect(parseLinkAndReturn(locationIndexUrl, "http://server/pre")).toEqual(
|
|
3350
|
-
"http://server/pre/index.html#!",
|
|
3351
|
-
);
|
|
3352
|
-
expect(
|
|
3353
|
-
parseLinkAndReturn(locationIndexUrl, "http://server/pre/"),
|
|
3354
|
-
).toEqual(undefined);
|
|
3355
|
-
expect(
|
|
3356
|
-
parseLinkAndReturn(locationIndexUrl, "http://server/pre/otherPath"),
|
|
3357
|
-
).toEqual("http://server/pre/index.html#!/otherPath");
|
|
3358
|
-
// Note: relies on the previous state!
|
|
3359
|
-
expect(
|
|
3360
|
-
parseLinkAndReturn(
|
|
3361
|
-
locationIndexUrl,
|
|
3362
|
-
"someIgnoredAbsoluteHref",
|
|
3363
|
-
"#test",
|
|
3364
|
-
),
|
|
3365
|
-
).toEqual("http://server/pre/index.html#!/otherPath#test");
|
|
3366
|
-
});
|
|
3367
|
-
|
|
3368
|
-
it("should throw on url(urlString, stateObject)", () => {
|
|
3369
|
-
expectThrowOnStateChange(locationUrl);
|
|
3370
|
-
});
|
|
3371
|
-
|
|
3372
|
-
// it("should not throw when base path is another domain", () => {
|
|
3373
|
-
// initService({ html5Mode: true, hashPrefix: "!", supportHistory: true });
|
|
3374
|
-
// inject(
|
|
3375
|
-
// initBrowser({
|
|
3376
|
-
// url: "http://domain.com/base/",
|
|
3377
|
-
// basePath: "http://otherdomain.com/base/",
|
|
3378
|
-
// }),
|
|
3379
|
-
// ($location) => {
|
|
3380
|
-
// expect(() => {
|
|
3381
|
-
// $location.absUrl();
|
|
3382
|
-
// }).not.toThrow();
|
|
3383
|
-
// },
|
|
3384
|
-
// );
|
|
3385
|
-
// });
|
|
3386
|
-
});
|
|
3387
|
-
|
|
3388
3313
|
// function mockUpBrowser(options) {
|
|
3389
3314
|
// module(($windowProvider, $browserProvider) => {
|
|
3390
3315
|
// let browser;
|
package/src/core/q/q.js
CHANGED
|
@@ -1,49 +1,44 @@
|
|
|
1
|
+
import {
|
|
2
|
+
forEach,
|
|
3
|
+
minErr,
|
|
4
|
+
isUndefined,
|
|
5
|
+
isFunction,
|
|
6
|
+
isObject,
|
|
7
|
+
isDefined,
|
|
8
|
+
isError,
|
|
9
|
+
toDebugString,
|
|
10
|
+
isPromiseLike,
|
|
11
|
+
} from "../../shared/utils";
|
|
12
|
+
|
|
1
13
|
/**
|
|
2
14
|
* @template T
|
|
3
|
-
* @typedef {Object}
|
|
15
|
+
* @typedef {Object} QPromise
|
|
4
16
|
* @property {function(
|
|
5
17
|
* ((value: T) => (PromiseLike<never>|PromiseLike<T>|T))|null,
|
|
6
18
|
* ((reason: any) => (PromiseLike<never>|PromiseLike<T>|T))|null,
|
|
7
19
|
* ((state: any) => any)
|
|
8
|
-
* ):
|
|
20
|
+
* ): QPromise<T|never>} then - Calls one of the success or error callbacks asynchronously as soon as the result is available.
|
|
9
21
|
* @property {function(
|
|
10
|
-
* ((value: T) => (
|
|
11
|
-
* ((reason: any) => (
|
|
22
|
+
* ((value: T) => (QPromise<never>|QPromise<T>|T))|null,
|
|
23
|
+
* ((reason: any) => (QPromise<never>|QPromise<never>|never))|null,
|
|
12
24
|
* ((state: any) => any)
|
|
13
|
-
* ):
|
|
14
|
-
* @property {function(((reason: any) => (PromiseLike<never>|PromiseLike<T>|T))|null):
|
|
15
|
-
* @property {function(((reason: any) => (
|
|
16
|
-
* @property {function(function(): void):
|
|
25
|
+
* ): QPromise<T|never>} then - Calls one of the success or error callbacks asynchronously as soon as the result is available.
|
|
26
|
+
* @property {function(((reason: any) => (PromiseLike<never>|PromiseLike<T>|T))|null): QPromise<T>|T} catch - Shorthand for promise.then(null, errorCallback).
|
|
27
|
+
* @property {function(((reason: any) => (QPromise<never>|QPromise<T>|T))|null): QPromise<T>|T} catch - Shorthand for promise.then(null, errorCallback).
|
|
28
|
+
* @property {function(function(): void): QPromise<T>} finally - Allows you to observe either the fulfillment or rejection of a promise, but to do so without modifying the final value.
|
|
29
|
+
* @property {number} [$$intervalId] - Internal id set by the $interval service for callback notifications
|
|
30
|
+
* @property {number} [$$timeoutId] - Timeout id set by the $timeout service for cancelations
|
|
17
31
|
*/
|
|
18
32
|
|
|
19
33
|
/**
|
|
20
34
|
*@template T
|
|
21
|
-
* @typedef {Object}
|
|
22
|
-
* @property {function(T|
|
|
35
|
+
* @typedef {Object} Deferred
|
|
36
|
+
* @property {function(T|QPromise<T>): void} resolve - Resolves the promise with a value or another promise.
|
|
23
37
|
* @property {function(any): void} reject - Rejects the promise with a reason.
|
|
24
38
|
* @property {function(any): void} notify - Provides a progress notification.
|
|
25
|
-
* @property {
|
|
39
|
+
* @property {QPromise<T>} promise - The promise associated with this deferred object.
|
|
26
40
|
*/
|
|
27
41
|
|
|
28
|
-
import {
|
|
29
|
-
forEach,
|
|
30
|
-
minErr,
|
|
31
|
-
isUndefined,
|
|
32
|
-
isFunction,
|
|
33
|
-
isObject,
|
|
34
|
-
isDefined,
|
|
35
|
-
isError,
|
|
36
|
-
toDebugString,
|
|
37
|
-
isPromiseLike,
|
|
38
|
-
} from "../../shared/utils";
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* @ngdoc provider
|
|
42
|
-
* @name $qProvider
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
* @description
|
|
46
|
-
*/
|
|
47
42
|
export function $QProvider() {
|
|
48
43
|
let errorOnUnhandledRejections = true;
|
|
49
44
|
this.$get = [
|
|
@@ -51,14 +46,16 @@ export function $QProvider() {
|
|
|
51
46
|
"$exceptionHandler",
|
|
52
47
|
/**
|
|
53
48
|
*
|
|
54
|
-
* @param {
|
|
49
|
+
* @param {import('../scope/scope').Scope} $rootScope
|
|
55
50
|
* @param {import('../exception-handler').ErrorHandler} $exceptionHandler
|
|
56
51
|
* @returns
|
|
57
52
|
*/
|
|
58
53
|
function ($rootScope, $exceptionHandler) {
|
|
59
54
|
return qFactory(
|
|
60
55
|
(callback) => {
|
|
61
|
-
$rootScope.$evalAsync(
|
|
56
|
+
$rootScope.$evalAsync(
|
|
57
|
+
/** @type {function(function):any} */ (callback),
|
|
58
|
+
);
|
|
62
59
|
},
|
|
63
60
|
$exceptionHandler,
|
|
64
61
|
errorOnUnhandledRejections,
|
|
@@ -129,11 +126,6 @@ function qFactory(nextTick, exceptionHandler, errorOnUnhandledRejections) {
|
|
|
129
126
|
const checkQueue = [];
|
|
130
127
|
|
|
131
128
|
/**
|
|
132
|
-
* @ngdoc method
|
|
133
|
-
* @name ng.$q#defer
|
|
134
|
-
* @kind function
|
|
135
|
-
*
|
|
136
|
-
* @description
|
|
137
129
|
* Creates a `Deferred` object which represents a task which will finish in the future.
|
|
138
130
|
*
|
|
139
131
|
* @returns {Deferred} Returns a new instance of deferred.
|
|
@@ -156,38 +148,45 @@ function qFactory(nextTick, exceptionHandler, errorOnUnhandledRejections) {
|
|
|
156
148
|
};
|
|
157
149
|
}
|
|
158
150
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
QPromise.prototype.then = function (onFulfilled, onRejected, progressBack) {
|
|
164
|
-
if (
|
|
165
|
-
isUndefined(onFulfilled) &&
|
|
166
|
-
isUndefined(onRejected) &&
|
|
167
|
-
isUndefined(progressBack)
|
|
168
|
-
) {
|
|
169
|
-
return this;
|
|
151
|
+
class QPromise {
|
|
152
|
+
constructor() {
|
|
153
|
+
this.$$state = { status: 0 };
|
|
170
154
|
}
|
|
171
|
-
const result = new QPromise();
|
|
172
|
-
|
|
173
|
-
this.$$state.pending = this.$$state.pending || [];
|
|
174
|
-
this.$$state.pending.push([result, onFulfilled, onRejected, progressBack]);
|
|
175
|
-
if (this.$$state.status > 0) scheduleProcessQueue(this.$$state);
|
|
176
155
|
|
|
177
|
-
|
|
178
|
-
|
|
156
|
+
then(onFulfilled, onRejected, progressBack) {
|
|
157
|
+
if (
|
|
158
|
+
isUndefined(onFulfilled) &&
|
|
159
|
+
isUndefined(onRejected) &&
|
|
160
|
+
isUndefined(progressBack)
|
|
161
|
+
) {
|
|
162
|
+
return this;
|
|
163
|
+
}
|
|
164
|
+
const result = new QPromise();
|
|
165
|
+
|
|
166
|
+
this.$$state.pending = this.$$state.pending || [];
|
|
167
|
+
this.$$state.pending.push([
|
|
168
|
+
result,
|
|
169
|
+
onFulfilled,
|
|
170
|
+
onRejected,
|
|
171
|
+
progressBack,
|
|
172
|
+
]);
|
|
173
|
+
if (this.$$state.status > 0) scheduleProcessQueue(this.$$state);
|
|
174
|
+
|
|
175
|
+
return result;
|
|
176
|
+
}
|
|
179
177
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
178
|
+
catch(callback) {
|
|
179
|
+
return this.then(null, callback);
|
|
180
|
+
}
|
|
183
181
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
182
|
+
finally(callback, progressBack) {
|
|
183
|
+
return this.then(
|
|
184
|
+
(value) => handleCallback(value, resolve, callback),
|
|
185
|
+
(error) => handleCallback(error, reject, callback),
|
|
186
|
+
progressBack,
|
|
187
|
+
);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
191
190
|
|
|
192
191
|
function processQueue(state) {
|
|
193
192
|
let fn;
|
package/src/core/q/q.spec.js
CHANGED
package/src/core/sce/sce.js
CHANGED
|
@@ -46,9 +46,7 @@ export const SCE_CONTEXTS = {
|
|
|
46
46
|
// http://docs.closure-library.googlecode.com/git/local_closure_goog_string_string.js.source.html#line1021
|
|
47
47
|
// Prereq: s is a string.
|
|
48
48
|
export function escapeForRegexp(s) {
|
|
49
|
-
return s
|
|
50
|
-
.replace(/([-()[\]{}+?*.$^|,:#<!\\])/g, "\\$1")
|
|
51
|
-
.replace(/\x08/g, "\\x08");
|
|
49
|
+
return s.replace(/([-()[\]{}+?*.$^|,:#<!\\])/g, "\\$1");
|
|
52
50
|
}
|
|
53
51
|
|
|
54
52
|
export function adjustMatcher(matcher) {
|
package/src/core/scope/scope.js
CHANGED
|
@@ -392,7 +392,7 @@ export class Scope {
|
|
|
392
392
|
*
|
|
393
393
|
* - `string`: Evaluated as {@link guide/expression expression}
|
|
394
394
|
* - `function(scope)`: called with current `scope` as a parameter.
|
|
395
|
-
* @param {WatchListener} listener
|
|
395
|
+
* @param {WatchListener} [listener]
|
|
396
396
|
* @param {boolean=} [objectEquality=false] Compare for object equality using {@link angular.equals} instead of
|
|
397
397
|
* comparing for reference equality.
|
|
398
398
|
* @returns {function()} Returns a deregistration function for this listener.
|
|
@@ -415,7 +415,7 @@ export class Scope {
|
|
|
415
415
|
|
|
416
416
|
lastDirtyWatch = null;
|
|
417
417
|
|
|
418
|
-
if (this.$$watchers.length
|
|
418
|
+
if (this.$$watchers.length === 0) {
|
|
419
419
|
this.$$digestWatchIndex = -1;
|
|
420
420
|
}
|
|
421
421
|
// we use unshift since we use a while loop in $digest for speed.
|
|
@@ -1155,7 +1155,7 @@ export class Scope {
|
|
|
1155
1155
|
* will be scheduled. However, it is encouraged to always call code that changes the model
|
|
1156
1156
|
* from within an `$apply` call. That includes code evaluated via `$evalAsync`.
|
|
1157
1157
|
*
|
|
1158
|
-
* @param {(string|function())=} expr An AngularTS expression to be executed.
|
|
1158
|
+
* @param {(string|function(any):any)=} expr An AngularTS expression to be executed.
|
|
1159
1159
|
*
|
|
1160
1160
|
* - `string`: execute using the rules as defined in {@link guide/expression expression}.
|
|
1161
1161
|
* - `function(scope)`: execute the function with the current `scope` parameter.
|
|
@@ -1187,9 +1187,6 @@ export class Scope {
|
|
|
1187
1187
|
return id;
|
|
1188
1188
|
}
|
|
1189
1189
|
|
|
1190
|
-
/**
|
|
1191
|
-
* @private
|
|
1192
|
-
*/
|
|
1193
1190
|
$$postDigest(fn) {
|
|
1194
1191
|
$$postDigestQueue.push(fn);
|
|
1195
1192
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { markQExceptionHandled } from "../q/q";
|
|
2
|
-
import { isDefined,
|
|
2
|
+
import { isDefined, minErr, sliceArgs } from "../../shared/utils";
|
|
3
3
|
|
|
4
4
|
const $timeoutMinErr = minErr("$timeout");
|
|
5
5
|
|
|
@@ -23,22 +23,16 @@ export function $TimeoutProvider() {
|
|
|
23
23
|
const deferreds = {};
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
|
-
|
|
27
|
-
* @name $timeout
|
|
28
|
-
*
|
|
29
|
-
* @description
|
|
26
|
+
|
|
30
27
|
* AngularJS's wrapper for `window.setTimeout`. The `fn` function is wrapped into a try/catch
|
|
31
28
|
* block and delegates any exceptions to
|
|
32
|
-
* {@link
|
|
29
|
+
* {@link $exceptionHandler} service.
|
|
33
30
|
*
|
|
34
31
|
* The return value of calling `$timeout` is a promise, which will be resolved when
|
|
35
32
|
* the delay has passed and the timeout function, if provided, is executed.
|
|
36
33
|
*
|
|
37
34
|
* To cancel a timeout request, call `$timeout.cancel(promise)`.
|
|
38
35
|
*
|
|
39
|
-
* In tests you can use {@link ngMock.$timeout `$timeout.flush()`} to
|
|
40
|
-
* synchronously flush the queue of deferred functions.
|
|
41
|
-
*
|
|
42
36
|
* If you only want a promise that will be resolved after some specified delay
|
|
43
37
|
* then you can call `$timeout` without the `fn` function.
|
|
44
38
|
*
|
|
@@ -46,17 +40,11 @@ export function $TimeoutProvider() {
|
|
|
46
40
|
* @param {number=} [delay=0] Delay in milliseconds.
|
|
47
41
|
* @param {boolean=} [invokeApply=true] If set to `false` skips model dirty checking, otherwise
|
|
48
42
|
* will invoke `fn` within the {@link ng.$rootScope.Scope#$apply $apply} block.
|
|
49
|
-
* @returns {
|
|
43
|
+
* @returns {import("../q/q").QPromise<any>} Promise that will be resolved when the timeout is reached. The promise
|
|
50
44
|
* will be resolved with the return value of the `fn` function.
|
|
51
45
|
*
|
|
52
46
|
*/
|
|
53
47
|
function timeout(fn, delay, invokeApply = true) {
|
|
54
|
-
if (!isFunction(fn)) {
|
|
55
|
-
invokeApply = delay;
|
|
56
|
-
delay = fn;
|
|
57
|
-
fn = () => {};
|
|
58
|
-
}
|
|
59
|
-
|
|
60
48
|
const args = sliceArgs(arguments, 3);
|
|
61
49
|
const skipApply = isDefined(invokeApply) && !invokeApply;
|
|
62
50
|
const deferred = (skipApply ? $$q : $q).defer();
|
|
@@ -87,14 +75,10 @@ export function $TimeoutProvider() {
|
|
|
87
75
|
}
|
|
88
76
|
|
|
89
77
|
/**
|
|
90
|
-
* @ngdoc method
|
|
91
|
-
* @name $timeout#cancel
|
|
92
|
-
*
|
|
93
|
-
* @description
|
|
94
78
|
* Cancels a task associated with the `promise`. As a result of this, the promise will be
|
|
95
79
|
* resolved with a rejection.
|
|
96
80
|
*
|
|
97
|
-
* @param {
|
|
81
|
+
* @param {import("../q/q").QPromise<any>} promise Promise returned by the `$timeout` function.
|
|
98
82
|
* @returns {boolean} Returns `true` if the task hasn't executed yet and was successfully
|
|
99
83
|
* canceled.
|
|
100
84
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Angular } from "../../loader";
|
|
2
2
|
import { createInjector } from "../../core/di/injector";
|
|
3
|
-
import { dealoc
|
|
3
|
+
import { dealoc } from "../../shared/jqlite/jqlite";
|
|
4
4
|
|
|
5
5
|
describe("boolean attr directives", () => {
|
|
6
6
|
let element, $rootScope, $compile, $rootElement;
|
|
@@ -37,8 +37,8 @@ export const ngBindHtmlDirective = [
|
|
|
37
37
|
return {
|
|
38
38
|
restrict: "A",
|
|
39
39
|
compile: (_tElement, tAttrs) => {
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
const ngBindHtmlGetter = $parse(tAttrs.ngBindHtml);
|
|
41
|
+
const ngBindHtmlWatch = $parse(tAttrs.ngBindHtml, (val) => val);
|
|
42
42
|
return (scope, element) => {
|
|
43
43
|
scope.$watch(ngBindHtmlWatch, () => {
|
|
44
44
|
// The watched value is the unwrapped value. To avoid re-escaping, use the direct getter.
|
|
@@ -153,12 +153,6 @@ FormController.prototype = {
|
|
|
153
153
|
},
|
|
154
154
|
|
|
155
155
|
/**
|
|
156
|
-
* @ngdoc method
|
|
157
|
-
* @name form.FormController#$addControl
|
|
158
|
-
* @param {object} control control object, either a {@link form.FormController} or an
|
|
159
|
-
* {@link ngModel.NgModelController}
|
|
160
|
-
*
|
|
161
|
-
* @description
|
|
162
156
|
* Register a control with the form. Input elements using ngModelController do this automatically
|
|
163
157
|
* when they are linked.
|
|
164
158
|
*
|
|
@@ -187,11 +181,6 @@ FormController.prototype = {
|
|
|
187
181
|
},
|
|
188
182
|
|
|
189
183
|
/**
|
|
190
|
-
* @ngdoc method
|
|
191
|
-
* @name form.FormController#$getControls
|
|
192
|
-
* @returns {Array} the controls that are currently part of this form
|
|
193
|
-
*
|
|
194
|
-
* @description
|
|
195
184
|
* This method returns a **shallow copy** of the controls that are currently part of this form.
|
|
196
185
|
* The controls can be instances of {@link form.FormController `FormController`}
|
|
197
186
|
* ({@link ngForm "child-forms"}) and of {@link ngModel.NgModelController `NgModelController`}.
|
|
@@ -222,12 +211,6 @@ FormController.prototype = {
|
|
|
222
211
|
},
|
|
223
212
|
|
|
224
213
|
/**
|
|
225
|
-
* @ngdoc method
|
|
226
|
-
* @name form.FormController#$removeControl
|
|
227
|
-
* @param {object} control control object, either a {@link form.FormController} or an
|
|
228
|
-
* {@link ngModel.NgModelController}
|
|
229
|
-
*
|
|
230
|
-
* @description
|
|
231
214
|
* Deregister a control from the form.
|
|
232
215
|
*
|
|
233
216
|
* Input elements using ngModelController do this automatically when they are destroyed.
|
|
@@ -382,7 +365,7 @@ FormController.prototype = {
|
|
|
382
365
|
* (undefined), or skipped (null). Pending is used for unfulfilled `$asyncValidators`.
|
|
383
366
|
* Skipped is used by AngularJS when validators do not run because of parse errors and when
|
|
384
367
|
* `$asyncValidators` do not run because any of the `$validators` failed.
|
|
385
|
-
* @param {NgModelController | FormController} controller - The controller whose validity state is
|
|
368
|
+
* @param {import("../model/model").NgModelController | FormController} controller - The controller whose validity state is
|
|
386
369
|
* triggering the change.
|
|
387
370
|
*/
|
|
388
371
|
addSetValidityMethod({
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Angular } from "../../loader";
|
|
2
2
|
import { createInjector } from "../../core/di/injector";
|
|
3
3
|
import { dealoc, JQLite } from "../../shared/jqlite/jqlite";
|
|
4
|
-
import { FormController } from "
|
|
4
|
+
import { FormController } from "./form";
|
|
5
5
|
|
|
6
6
|
describe("form", () => {
|
|
7
7
|
let doc;
|
|
@@ -679,7 +679,7 @@ describe("form", () => {
|
|
|
679
679
|
$compile(doc)(scope);
|
|
680
680
|
scope.$apply();
|
|
681
681
|
|
|
682
|
-
|
|
682
|
+
const parent = scope.parent,
|
|
683
683
|
child = scope.child;
|
|
684
684
|
|
|
685
685
|
expect(parent).toBeDefined();
|
|
@@ -7,6 +7,13 @@ export const ngIncludeDirective = [
|
|
|
7
7
|
"$templateRequest",
|
|
8
8
|
"$anchorScroll",
|
|
9
9
|
"$animate",
|
|
10
|
+
/**
|
|
11
|
+
*
|
|
12
|
+
* @param {*} $templateRequest
|
|
13
|
+
* @param {import("../../services/anchor-scroll").AnchorScrollFunction} $anchorScroll
|
|
14
|
+
* @param {*} $animate
|
|
15
|
+
* @returns
|
|
16
|
+
*/
|
|
10
17
|
($templateRequest, $anchorScroll, $animate) => ({
|
|
11
18
|
restrict: "ECA",
|
|
12
19
|
priority: 400,
|
|
@@ -203,7 +203,7 @@ export function weekParser(isoWeek, existingDate) {
|
|
|
203
203
|
|
|
204
204
|
function getFirstThursdayOfYear(year) {
|
|
205
205
|
// 0 = index of January
|
|
206
|
-
|
|
206
|
+
const dayOfWeekOnFirst = new Date(year, 0, 1).getDay();
|
|
207
207
|
// 4 = index of Thursday (+1 to account for 1st = 5)
|
|
208
208
|
// 11 = index of *next* Thursday (+1 account for 1st = 12)
|
|
209
209
|
return new Date(
|