angularjs-rails 1.6.2 → 1.6.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/angularjs-rails/version.rb +1 -1
- data/vendor/assets/javascripts/angular-animate.js +35 -27
- data/vendor/assets/javascripts/angular-aria.js +2 -3
- data/vendor/assets/javascripts/angular-cookies.js +2 -6
- data/vendor/assets/javascripts/angular-loader.js +143 -19
- data/vendor/assets/javascripts/angular-message-format.js +6 -9
- data/vendor/assets/javascripts/angular-messages.js +4 -2
- data/vendor/assets/javascripts/angular-mocks.js +84 -28
- data/vendor/assets/javascripts/angular-parse-ext.js +3 -7
- data/vendor/assets/javascripts/angular-resource.js +36 -28
- data/vendor/assets/javascripts/angular-route.js +5 -9
- data/vendor/assets/javascripts/angular-sanitize.js +98 -36
- data/vendor/assets/javascripts/angular-scenario.js +2480 -1180
- data/vendor/assets/javascripts/angular-touch.js +5 -8
- data/vendor/assets/javascripts/angular.js +2009 -888
- metadata +2 -2
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* @license AngularJS v1.6.
|
2
|
+
* @license AngularJS v1.6.8
|
3
3
|
* (c) 2010-2017 Google, Inc. http://angularjs.org
|
4
4
|
* License: MIT
|
5
5
|
*/
|
@@ -25,7 +25,7 @@ var jqLite;
|
|
25
25
|
* Currently, the ngMessages module only contains the code for the `ngMessages`, `ngMessagesInclude`
|
26
26
|
* `ngMessage` and `ngMessageExp` directives.
|
27
27
|
*
|
28
|
-
*
|
28
|
+
* ## Usage
|
29
29
|
* The `ngMessages` directive allows keys in a key/value collection to be associated with a child element
|
30
30
|
* (or 'message') that will show or hide based on the truthiness of that key's value in the collection. A common use
|
31
31
|
* case for `ngMessages` is to display error messages for inputs using the `$error` object exposed by the
|
@@ -272,6 +272,7 @@ angular.module('ngMessages', [], function initAngularHelpers() {
|
|
272
272
|
isString = angular.isString;
|
273
273
|
jqLite = angular.element;
|
274
274
|
})
|
275
|
+
.info({ angularVersion: '1.6.8' })
|
275
276
|
|
276
277
|
/**
|
277
278
|
* @ngdoc directive
|
@@ -596,6 +597,7 @@ angular.module('ngMessages', [], function initAngularHelpers() {
|
|
596
597
|
* @name ngMessage
|
597
598
|
* @restrict AE
|
598
599
|
* @scope
|
600
|
+
* @priority 1
|
599
601
|
*
|
600
602
|
* @description
|
601
603
|
* `ngMessage` is a directive with the purpose to show and hide a particular message.
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* @license AngularJS v1.6.
|
2
|
+
* @license AngularJS v1.6.8
|
3
3
|
* (c) 2010-2017 Google, Inc. http://angularjs.org
|
4
4
|
* License: MIT
|
5
5
|
*/
|
@@ -511,8 +511,8 @@ angular.mock.$IntervalProvider = function() {
|
|
511
511
|
}
|
512
512
|
|
513
513
|
repeatFns.push({
|
514
|
-
nextTime:(now + delay),
|
515
|
-
delay: delay,
|
514
|
+
nextTime: (now + (delay || 0)),
|
515
|
+
delay: delay || 1,
|
516
516
|
fn: tick,
|
517
517
|
id: nextRepeatId,
|
518
518
|
deferred: deferred
|
@@ -562,10 +562,16 @@ angular.mock.$IntervalProvider = function() {
|
|
562
562
|
* @return {number} The amount of time moved forward.
|
563
563
|
*/
|
564
564
|
$interval.flush = function(millis) {
|
565
|
+
var before = now;
|
565
566
|
now += millis;
|
566
567
|
while (repeatFns.length && repeatFns[0].nextTime <= now) {
|
567
568
|
var task = repeatFns[0];
|
568
569
|
task.fn();
|
570
|
+
if (task.nextTime === before) {
|
571
|
+
// this can only happen the first time
|
572
|
+
// a zero-delay interval gets triggered
|
573
|
+
task.nextTime++;
|
574
|
+
}
|
569
575
|
task.nextTime += task.delay;
|
570
576
|
repeatFns.sort(function(a, b) { return a.nextTime - b.nextTime;});
|
571
577
|
}
|
@@ -797,6 +803,7 @@ angular.mock.TzDate.prototype = Date.prototype;
|
|
797
803
|
* You need to require the `ngAnimateMock` module in your test suite for instance `beforeEach(module('ngAnimateMock'))`
|
798
804
|
*/
|
799
805
|
angular.mock.animate = angular.module('ngAnimateMock', ['ng'])
|
806
|
+
.info({ angularVersion: '1.6.8' })
|
800
807
|
|
801
808
|
.config(['$provide', function($provide) {
|
802
809
|
|
@@ -1139,6 +1146,8 @@ angular.mock.dump = function(object) {
|
|
1139
1146
|
$http.get('/auth.py').then(function(response) {
|
1140
1147
|
authToken = response.headers('A-Token');
|
1141
1148
|
$scope.user = response.data;
|
1149
|
+
}).catch(function() {
|
1150
|
+
$scope.status = 'Failed...';
|
1142
1151
|
});
|
1143
1152
|
|
1144
1153
|
$scope.saveMessage = function(message) {
|
@@ -1352,8 +1361,8 @@ function createHttpBackendMock($rootScope, $timeout, $delegate, $browser) {
|
|
1352
1361
|
|
1353
1362
|
return function() {
|
1354
1363
|
return angular.isNumber(status)
|
1355
|
-
? [status, data, headers, statusText]
|
1356
|
-
: [200, status, data, headers];
|
1364
|
+
? [status, data, headers, statusText, 'complete']
|
1365
|
+
: [200, status, data, headers, 'complete'];
|
1357
1366
|
};
|
1358
1367
|
}
|
1359
1368
|
|
@@ -1382,20 +1391,21 @@ function createHttpBackendMock($rootScope, $timeout, $delegate, $browser) {
|
|
1382
1391
|
}
|
1383
1392
|
}
|
1384
1393
|
|
1394
|
+
handleResponse.description = method + ' ' + url;
|
1385
1395
|
return handleResponse;
|
1386
1396
|
|
1387
1397
|
function handleResponse() {
|
1388
1398
|
var response = wrapped.response(method, url, data, headers, wrapped.params(url));
|
1389
1399
|
xhr.$$respHeaders = response[2];
|
1390
1400
|
callback(copy(response[0]), copy(response[1]), xhr.getAllResponseHeaders(),
|
1391
|
-
copy(response[3] || ''));
|
1401
|
+
copy(response[3] || ''), copy(response[4]));
|
1392
1402
|
}
|
1393
1403
|
|
1394
1404
|
function handleTimeout() {
|
1395
1405
|
for (var i = 0, ii = responses.length; i < ii; i++) {
|
1396
1406
|
if (responses[i] === handleResponse) {
|
1397
1407
|
responses.splice(i, 1);
|
1398
|
-
callback(-1, undefined, '');
|
1408
|
+
callback(-1, undefined, '', undefined, 'timeout');
|
1399
1409
|
break;
|
1400
1410
|
}
|
1401
1411
|
}
|
@@ -1435,10 +1445,16 @@ function createHttpBackendMock($rootScope, $timeout, $delegate, $browser) {
|
|
1435
1445
|
return;
|
1436
1446
|
}
|
1437
1447
|
}
|
1438
|
-
|
1448
|
+
var error = wasExpected ?
|
1439
1449
|
new Error('No response defined !') :
|
1440
1450
|
new Error('Unexpected request: ' + method + ' ' + url + '\n' +
|
1441
1451
|
(expectation ? 'Expected ' + expectation : 'No more request expected'));
|
1452
|
+
|
1453
|
+
// In addition to be being converted to a rejection, this error also needs to be passed to
|
1454
|
+
// the $exceptionHandler and be rethrown (so that the test fails).
|
1455
|
+
error.$$passToExceptionHandler = true;
|
1456
|
+
|
1457
|
+
throw error;
|
1442
1458
|
}
|
1443
1459
|
|
1444
1460
|
/**
|
@@ -1888,7 +1904,9 @@ function createHttpBackendMock($rootScope, $timeout, $delegate, $browser) {
|
|
1888
1904
|
$httpBackend.verifyNoOutstandingRequest = function(digest) {
|
1889
1905
|
if (digest !== false) $rootScope.$digest();
|
1890
1906
|
if (responses.length) {
|
1891
|
-
|
1907
|
+
var unflushedDescriptions = responses.map(function(res) { return res.description; });
|
1908
|
+
throw new Error('Unflushed requests: ' + responses.length + '\n ' +
|
1909
|
+
unflushedDescriptions.join('\n '));
|
1892
1910
|
}
|
1893
1911
|
};
|
1894
1912
|
|
@@ -2361,15 +2379,10 @@ angular.mock.$ComponentControllerProvider = ['$compileProvider',
|
|
2361
2379
|
* @packageName angular-mocks
|
2362
2380
|
* @description
|
2363
2381
|
*
|
2364
|
-
*
|
2365
|
-
*
|
2366
|
-
* The `ngMock` module provides support to inject and mock Angular services into unit tests.
|
2367
|
-
* In addition, ngMock also extends various core ng services such that they can be
|
2382
|
+
* The `ngMock` module provides support to inject and mock AngularJS services into unit tests.
|
2383
|
+
* In addition, ngMock also extends various core AngularJS services such that they can be
|
2368
2384
|
* inspected and controlled in a synchronous manner within test code.
|
2369
2385
|
*
|
2370
|
-
*
|
2371
|
-
* <div doc-module-components="ngMock"></div>
|
2372
|
-
*
|
2373
2386
|
* @installation
|
2374
2387
|
*
|
2375
2388
|
* First, download the file:
|
@@ -2413,7 +2426,7 @@ angular.module('ngMock', ['ng']).provider({
|
|
2413
2426
|
$provide.decorator('$rootScope', angular.mock.$RootScopeDecorator);
|
2414
2427
|
$provide.decorator('$controller', createControllerDecorator($compileProvider));
|
2415
2428
|
$provide.decorator('$httpBackend', angular.mock.$httpBackendDecorator);
|
2416
|
-
}]);
|
2429
|
+
}]).info({ angularVersion: '1.6.8' });
|
2417
2430
|
|
2418
2431
|
/**
|
2419
2432
|
* @ngdoc module
|
@@ -2428,7 +2441,7 @@ angular.module('ngMock', ['ng']).provider({
|
|
2428
2441
|
*/
|
2429
2442
|
angular.module('ngMockE2E', ['ng']).config(['$provide', function($provide) {
|
2430
2443
|
$provide.decorator('$httpBackend', angular.mock.e2e.$httpBackendDecorator);
|
2431
|
-
}]);
|
2444
|
+
}]).info({ angularVersion: '1.6.8' });
|
2432
2445
|
|
2433
2446
|
/**
|
2434
2447
|
* @ngdoc service
|
@@ -2482,7 +2495,7 @@ angular.module('ngMockE2E', ['ng']).config(['$provide', function($provide) {
|
|
2482
2495
|
*
|
2483
2496
|
* Afterwards, bootstrap your app with this new module.
|
2484
2497
|
*
|
2485
|
-
*
|
2498
|
+
* @example
|
2486
2499
|
* <example name="httpbackend-e2e-testing" module="myAppE2E" deps="angular-mocks.js">
|
2487
2500
|
* <file name="app.js">
|
2488
2501
|
* var myApp = angular.module('myApp', []);
|
@@ -3210,13 +3223,56 @@ angular.mock.$RootScopeDecorator = ['$delegate', function($delegate) {
|
|
3210
3223
|
|
3211
3224
|
(function() {
|
3212
3225
|
/**
|
3213
|
-
*
|
3214
|
-
*
|
3226
|
+
* @ngdoc function
|
3227
|
+
* @name browserTrigger
|
3228
|
+
* @description
|
3229
|
+
*
|
3230
|
+
* This is a global (window) function that is only available when the {@link ngMock} module is
|
3231
|
+
* included.
|
3232
|
+
*
|
3233
|
+
* It can be used to trigger a native browser event on an element, which is useful for unit testing.
|
3234
|
+
*
|
3215
3235
|
*
|
3216
3236
|
* @param {Object} element Either a wrapped jQuery/jqLite node or a DOMElement
|
3217
|
-
* @param {string} eventType Optional event type
|
3218
|
-
*
|
3219
|
-
*
|
3237
|
+
* @param {string=} eventType Optional event type. If none is specified, the function tries
|
3238
|
+
* to determine the right event type for the element, e.g. `change` for
|
3239
|
+
* `input[text]`.
|
3240
|
+
* @param {Object=} eventData An optional object which contains additional event data that is used
|
3241
|
+
* when creating the event:
|
3242
|
+
*
|
3243
|
+
* - `bubbles`: [Event.bubbles](https://developer.mozilla.org/docs/Web/API/Event/bubbles).
|
3244
|
+
* Not applicable to all events.
|
3245
|
+
*
|
3246
|
+
* - `cancelable`: [Event.cancelable](https://developer.mozilla.org/docs/Web/API/Event/cancelable).
|
3247
|
+
* Not applicable to all events.
|
3248
|
+
*
|
3249
|
+
* - `charcode`: [charCode](https://developer.mozilla.org/docs/Web/API/KeyboardEvent/charcode)
|
3250
|
+
* for keyboard events (keydown, keypress, and keyup).
|
3251
|
+
*
|
3252
|
+
* - `elapsedTime`: the elapsedTime for
|
3253
|
+
* [TransitionEvent](https://developer.mozilla.org/docs/Web/API/TransitionEvent)
|
3254
|
+
* and [AnimationEvent](https://developer.mozilla.org/docs/Web/API/AnimationEvent).
|
3255
|
+
*
|
3256
|
+
* - `keycode`: [keyCode](https://developer.mozilla.org/docs/Web/API/KeyboardEvent/keycode)
|
3257
|
+
* for keyboard events (keydown, keypress, and keyup).
|
3258
|
+
*
|
3259
|
+
* - `keys`: an array of possible modifier keys (ctrl, alt, shift, meta) for
|
3260
|
+
* [MouseEvent](https://developer.mozilla.org/docs/Web/API/MouseEvent) and
|
3261
|
+
* keyboard events (keydown, keypress, and keyup).
|
3262
|
+
*
|
3263
|
+
* - `relatedTarget`: the
|
3264
|
+
* [relatedTarget](https://developer.mozilla.org/docs/Web/API/MouseEvent/relatedTarget)
|
3265
|
+
* for [MouseEvent](https://developer.mozilla.org/docs/Web/API/MouseEvent).
|
3266
|
+
*
|
3267
|
+
* - `which`: [which](https://developer.mozilla.org/docs/Web/API/KeyboardEvent/which)
|
3268
|
+
* for keyboard events (keydown, keypress, and keyup).
|
3269
|
+
*
|
3270
|
+
* - `x`: x-coordinates for [MouseEvent](https://developer.mozilla.org/docs/Web/API/MouseEvent)
|
3271
|
+
* and [TouchEvent](https://developer.mozilla.org/docs/Web/API/TouchEvent).
|
3272
|
+
*
|
3273
|
+
* - `y`: y-coordinates for [MouseEvent](https://developer.mozilla.org/docs/Web/API/MouseEvent)
|
3274
|
+
* and [TouchEvent](https://developer.mozilla.org/docs/Web/API/TouchEvent).
|
3275
|
+
*
|
3220
3276
|
*/
|
3221
3277
|
window.browserTrigger = function browserTrigger(element, eventType, eventData) {
|
3222
3278
|
if (element && !element.nodeName) element = element[0];
|
@@ -3263,25 +3319,25 @@ angular.mock.$RootScopeDecorator = ['$delegate', function($delegate) {
|
|
3263
3319
|
if (/transitionend/.test(eventType)) {
|
3264
3320
|
if (window.WebKitTransitionEvent) {
|
3265
3321
|
evnt = new window.WebKitTransitionEvent(eventType, eventData);
|
3266
|
-
evnt.initEvent(eventType,
|
3322
|
+
evnt.initEvent(eventType, eventData.bubbles, true);
|
3267
3323
|
} else {
|
3268
3324
|
try {
|
3269
3325
|
evnt = new window.TransitionEvent(eventType, eventData);
|
3270
3326
|
} catch (e) {
|
3271
3327
|
evnt = window.document.createEvent('TransitionEvent');
|
3272
|
-
evnt.initTransitionEvent(eventType,
|
3328
|
+
evnt.initTransitionEvent(eventType, eventData.bubbles, null, null, eventData.elapsedTime || 0);
|
3273
3329
|
}
|
3274
3330
|
}
|
3275
3331
|
} else if (/animationend/.test(eventType)) {
|
3276
3332
|
if (window.WebKitAnimationEvent) {
|
3277
3333
|
evnt = new window.WebKitAnimationEvent(eventType, eventData);
|
3278
|
-
evnt.initEvent(eventType,
|
3334
|
+
evnt.initEvent(eventType, eventData.bubbles, true);
|
3279
3335
|
} else {
|
3280
3336
|
try {
|
3281
3337
|
evnt = new window.AnimationEvent(eventType, eventData);
|
3282
3338
|
} catch (e) {
|
3283
3339
|
evnt = window.document.createEvent('AnimationEvent');
|
3284
|
-
evnt.initAnimationEvent(eventType,
|
3340
|
+
evnt.initAnimationEvent(eventType, eventData.bubbles, null, null, eventData.elapsedTime || 0);
|
3285
3341
|
}
|
3286
3342
|
}
|
3287
3343
|
} else if (/touch/.test(eventType) && supportsTouchEvents()) {
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* @license AngularJS v1.6.
|
2
|
+
* @license AngularJS v1.6.8
|
3
3
|
* (c) 2010-2017 Google, Inc. http://angularjs.org
|
4
4
|
* License: MIT
|
5
5
|
*/
|
@@ -1231,14 +1231,9 @@ function IDC_Y(cp) {
|
|
1231
1231
|
* @packageName angular-parse-ext
|
1232
1232
|
* @description
|
1233
1233
|
*
|
1234
|
-
* # ngParseExt
|
1235
|
-
*
|
1236
1234
|
* The `ngParseExt` module provides functionality to allow Unicode characters in
|
1237
1235
|
* identifiers inside Angular expressions.
|
1238
1236
|
*
|
1239
|
-
*
|
1240
|
-
* <div doc-module-components="ngParseExt"></div>
|
1241
|
-
*
|
1242
1237
|
* This module allows the usage of any identifier that follows ES6 identifier naming convention
|
1243
1238
|
* to be used as an identifier in an Angular expression. ES6 delegates some of the identifier
|
1244
1239
|
* rules definition to Unicode, this module uses ES6 and Unicode 8.0 identifiers convention.
|
@@ -1267,7 +1262,8 @@ function isValidIdentifierContinue(ch, cp) {
|
|
1267
1262
|
angular.module('ngParseExt', [])
|
1268
1263
|
.config(['$parseProvider', function($parseProvider) {
|
1269
1264
|
$parseProvider.setIdentifierFns(isValidIdentifierStart, isValidIdentifierContinue);
|
1270
|
-
}])
|
1265
|
+
}])
|
1266
|
+
.info({ angularVersion: '1.6.8' });
|
1271
1267
|
|
1272
1268
|
|
1273
1269
|
})(window, window.angular);
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* @license AngularJS v1.6.
|
2
|
+
* @license AngularJS v1.6.8
|
3
3
|
* (c) 2010-2017 Google, Inc. http://angularjs.org
|
4
4
|
* License: MIT
|
5
5
|
*/
|
@@ -53,14 +53,9 @@ function shallowClearAndCopy(src, dst) {
|
|
53
53
|
* @name ngResource
|
54
54
|
* @description
|
55
55
|
*
|
56
|
-
* # ngResource
|
57
|
-
*
|
58
56
|
* The `ngResource` module provides interaction support with RESTful services
|
59
57
|
* via the $resource service.
|
60
58
|
*
|
61
|
-
*
|
62
|
-
* <div doc-module-components="ngResource"></div>
|
63
|
-
*
|
64
59
|
* See {@link ngResource.$resourceProvider} and {@link ngResource.$resource} for usage.
|
65
60
|
*/
|
66
61
|
|
@@ -130,8 +125,8 @@ function shallowClearAndCopy(src, dst) {
|
|
130
125
|
* URL `/path/greet?salutation=Hello`.
|
131
126
|
*
|
132
127
|
* If the parameter value is prefixed with `@`, then the value for that parameter will be
|
133
|
-
* extracted from the corresponding property on the `data` object (provided when calling
|
134
|
-
*
|
128
|
+
* extracted from the corresponding property on the `data` object (provided when calling actions
|
129
|
+
* with a request body).
|
135
130
|
* For example, if the `defaultParam` object is `{someParam: '@someProp'}` then the value of
|
136
131
|
* `someParam` will be `data.someProp`.
|
137
132
|
* Note that the parameter will be ignored, when calling a "GET" action method (i.e. an action
|
@@ -179,7 +174,7 @@ function shallowClearAndCopy(src, dst) {
|
|
179
174
|
* set `transformResponse` to an empty array: `transformResponse: []`
|
180
175
|
* - **`cache`** – `{boolean|Cache}` – If true, a default $http cache will be used to cache the
|
181
176
|
* GET request, otherwise if a cache instance built with
|
182
|
-
* {@link ng.$cacheFactory $cacheFactory}, this cache will be used for
|
177
|
+
* {@link ng.$cacheFactory $cacheFactory} is supplied, this cache will be used for
|
183
178
|
* caching.
|
184
179
|
* - **`timeout`** – `{number}` – timeout in milliseconds.<br />
|
185
180
|
* **Note:** In contrast to {@link ng.$http#usage $http.config}, {@link ng.$q promises} are
|
@@ -197,7 +192,14 @@ function shallowClearAndCopy(src, dst) {
|
|
197
192
|
* [requestType](https://developer.mozilla.org/en-US/docs/DOM/XMLHttpRequest#responseType).
|
198
193
|
* - **`interceptor`** - `{Object=}` - The interceptor object has two optional methods -
|
199
194
|
* `response` and `responseError`. Both `response` and `responseError` interceptors get called
|
200
|
-
* with `http response` object. See {@link ng.$http $http interceptors}.
|
195
|
+
* with `http response` object. See {@link ng.$http $http interceptors}. In addition, the
|
196
|
+
* resource instance or array object is accessible by the `resource` property of the
|
197
|
+
* `http response` object.
|
198
|
+
* Keep in mind that the associated promise will be resolved with the value returned by the
|
199
|
+
* response interceptor, if one is specified. The default response interceptor returns
|
200
|
+
* `response.resource` (i.e. the resource instance or array).
|
201
|
+
* - **`hasBody`** - `{boolean}` - allows to specify if a request body should be included or not.
|
202
|
+
* If not specified only POST, PUT and PATCH requests will have a body.
|
201
203
|
*
|
202
204
|
* @param {Object} options Hash with custom settings that should extend the
|
203
205
|
* default `$resourceProvider` behavior. The supported options are:
|
@@ -242,9 +244,15 @@ function shallowClearAndCopy(src, dst) {
|
|
242
244
|
* The action methods on the class object or instance object can be invoked with the following
|
243
245
|
* parameters:
|
244
246
|
*
|
245
|
-
* -
|
246
|
-
* -
|
247
|
-
* -
|
247
|
+
* - "class" actions without a body: `Resource.action([parameters], [success], [error])`
|
248
|
+
* - "class" actions with a body: `Resource.action([parameters], postData, [success], [error])`
|
249
|
+
* - instance actions: `instance.$action([parameters], [success], [error])`
|
250
|
+
*
|
251
|
+
*
|
252
|
+
* When calling instance methods, the instance itself is used as the request body (if the action
|
253
|
+
* should have a body). By default, only actions using `POST`, `PUT` or `PATCH` have request
|
254
|
+
* bodies, but you can use the `hasBody` configuration option to specify whether an action
|
255
|
+
* should have a body or not (regardless of its HTTP method).
|
248
256
|
*
|
249
257
|
*
|
250
258
|
* Success callback is called with (value (Object|Array), responseHeaders (Function),
|
@@ -264,8 +272,7 @@ function shallowClearAndCopy(src, dst) {
|
|
264
272
|
* {@link ngRoute.$routeProvider resolve section of $routeProvider.when()} to defer view
|
265
273
|
* rendering until the resource(s) are loaded.
|
266
274
|
*
|
267
|
-
* On failure, the promise is rejected with the {@link ng.$http http response} object
|
268
|
-
* the `resource` property.
|
275
|
+
* On failure, the promise is rejected with the {@link ng.$http http response} object.
|
269
276
|
*
|
270
277
|
* If an interceptor object was provided, the promise will instead be resolved with the value
|
271
278
|
* returned by the interceptor.
|
@@ -285,11 +292,11 @@ function shallowClearAndCopy(src, dst) {
|
|
285
292
|
* the Resource API. This object can be serialized through {@link angular.toJson} safely
|
286
293
|
* without attaching Angular-specific fields. Notice that `JSON.stringify` (and
|
287
294
|
* `angular.toJson`) automatically use this method when serializing a Resource instance
|
288
|
-
* (see [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#toJSON
|
295
|
+
* (see [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify#toJSON%28%29_behavior)).
|
289
296
|
*
|
290
297
|
* @example
|
291
298
|
*
|
292
|
-
*
|
299
|
+
* ### Credit card resource
|
293
300
|
*
|
294
301
|
* ```js
|
295
302
|
// Define CreditCard class
|
@@ -334,7 +341,7 @@ function shallowClearAndCopy(src, dst) {
|
|
334
341
|
*
|
335
342
|
* @example
|
336
343
|
*
|
337
|
-
*
|
344
|
+
* ### User resource
|
338
345
|
*
|
339
346
|
* When the data is returned from the server then the object is an instance of the resource type and
|
340
347
|
* all of the non-GET methods are available with `$` prefix. This allows you to easily support CRUD
|
@@ -375,7 +382,7 @@ function shallowClearAndCopy(src, dst) {
|
|
375
382
|
*
|
376
383
|
* @example
|
377
384
|
*
|
378
|
-
*
|
385
|
+
* ### Creating a custom 'PUT' request
|
379
386
|
*
|
380
387
|
* In this example we create a custom method on our resource to make a PUT request
|
381
388
|
* ```js
|
@@ -407,7 +414,7 @@ function shallowClearAndCopy(src, dst) {
|
|
407
414
|
*
|
408
415
|
* @example
|
409
416
|
*
|
410
|
-
*
|
417
|
+
* ### Cancelling requests
|
411
418
|
*
|
412
419
|
* If an action's configuration specifies that it is cancellable, you can cancel the request related
|
413
420
|
* to an instance or collection (as long as it is a result of a "non-instance" call):
|
@@ -434,6 +441,7 @@ function shallowClearAndCopy(src, dst) {
|
|
434
441
|
*
|
435
442
|
*/
|
436
443
|
angular.module('ngResource', ['ng']).
|
444
|
+
info({ angularVersion: '1.6.8' }).
|
437
445
|
provider('$resource', function ResourceProvider() {
|
438
446
|
var PROTOCOL_AND_IPV6_REGEX = /^https?:\/\/\[[^\]]*][^/]*/;
|
439
447
|
|
@@ -484,7 +492,7 @@ angular.module('ngResource', ['ng']).
|
|
484
492
|
* $resourceProvider.defaults.actions.update = {
|
485
493
|
* method: 'PUT'
|
486
494
|
* };
|
487
|
-
* });
|
495
|
+
* }]);
|
488
496
|
* ```
|
489
497
|
*
|
490
498
|
* Or you can even overwrite the whole `actions` list and specify your own:
|
@@ -647,7 +655,7 @@ angular.module('ngResource', ['ng']).
|
|
647
655
|
};
|
648
656
|
|
649
657
|
forEach(actions, function(action, name) {
|
650
|
-
var hasBody = /^(POST|PUT|PATCH)$/i.test(action.method);
|
658
|
+
var hasBody = action.hasBody === true || (action.hasBody !== false && /^(POST|PUT|PATCH)$/i.test(action.method));
|
651
659
|
var numericTimeout = action.timeout;
|
652
660
|
var cancellable = isDefined(action.cancellable) ?
|
653
661
|
action.cancellable : route.defaults.cancellable;
|
@@ -772,6 +780,9 @@ angular.module('ngResource', ['ng']).
|
|
772
780
|
response.resource = value;
|
773
781
|
|
774
782
|
return response;
|
783
|
+
}, function(response) {
|
784
|
+
response.resource = value;
|
785
|
+
return $q.reject(response);
|
775
786
|
});
|
776
787
|
|
777
788
|
promise = promise['finally'](function() {
|
@@ -819,7 +830,9 @@ angular.module('ngResource', ['ng']).
|
|
819
830
|
|
820
831
|
function cancelRequest(value) {
|
821
832
|
promise.catch(noop);
|
822
|
-
timeoutDeferred
|
833
|
+
if (timeoutDeferred !== null) {
|
834
|
+
timeoutDeferred.resolve(value);
|
835
|
+
}
|
823
836
|
}
|
824
837
|
};
|
825
838
|
|
@@ -833,11 +846,6 @@ angular.module('ngResource', ['ng']).
|
|
833
846
|
};
|
834
847
|
});
|
835
848
|
|
836
|
-
Resource.bind = function(additionalParamDefaults) {
|
837
|
-
var extendedParamDefaults = extend({}, paramDefaults, additionalParamDefaults);
|
838
|
-
return resourceFactory(url, extendedParamDefaults, actions, options);
|
839
|
-
};
|
840
|
-
|
841
849
|
return Resource;
|
842
850
|
}
|
843
851
|
|