angularjs-rails 1.2.26 → 1.3.0
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 +2 -2
- data/vendor/assets/javascripts/angular-animate.js +879 -456
- data/vendor/assets/javascripts/angular-aria.js +250 -0
- data/vendor/assets/javascripts/angular-cookies.js +1 -1
- data/vendor/assets/javascripts/angular-loader.js +17 -10
- data/vendor/assets/javascripts/angular-messages.js +400 -0
- data/vendor/assets/javascripts/angular-mocks.js +220 -110
- data/vendor/assets/javascripts/angular-resource.js +287 -247
- data/vendor/assets/javascripts/angular-route.js +111 -54
- data/vendor/assets/javascripts/angular-sanitize.js +1 -1
- data/vendor/assets/javascripts/angular-scenario.js +11579 -8665
- data/vendor/assets/javascripts/angular-touch.js +49 -11
- data/vendor/assets/javascripts/angular.js +6660 -3106
- data/vendor/assets/javascripts/unstable/angular-animate.js +240 -71
- data/vendor/assets/javascripts/unstable/angular-aria.js +12 -12
- data/vendor/assets/javascripts/unstable/angular-cookies.js +1 -1
- data/vendor/assets/javascripts/unstable/angular-loader.js +4 -4
- data/vendor/assets/javascripts/unstable/angular-messages.js +1 -1
- data/vendor/assets/javascripts/unstable/angular-mocks.js +21 -14
- data/vendor/assets/javascripts/unstable/angular-resource.js +2 -2
- data/vendor/assets/javascripts/unstable/angular-route.js +1 -1
- data/vendor/assets/javascripts/unstable/angular-sanitize.js +1 -1
- data/vendor/assets/javascripts/unstable/angular-scenario.js +562 -262
- data/vendor/assets/javascripts/unstable/angular-touch.js +1 -1
- data/vendor/assets/javascripts/unstable/angular.js +562 -262
- metadata +16 -14
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* @license AngularJS v1.
|
2
|
+
* @license AngularJS v1.3.0
|
3
3
|
* (c) 2010-2014 Google, Inc. http://angularjs.org
|
4
4
|
* License: MIT
|
5
5
|
*/
|
@@ -78,6 +78,18 @@ function shallowClearAndCopy(src, dst) {
|
|
78
78
|
*
|
79
79
|
* Requires the {@link ngResource `ngResource`} module to be installed.
|
80
80
|
*
|
81
|
+
* By default, trailing slashes will be stripped from the calculated URLs,
|
82
|
+
* which can pose problems with server backends that do not expect that
|
83
|
+
* behavior. This can be disabled by configuring the `$resourceProvider` like
|
84
|
+
* this:
|
85
|
+
*
|
86
|
+
* ```js
|
87
|
+
app.config(['$resourceProvider', function ($resourceProvider) {
|
88
|
+
// Don't strip trailing slashes from calculated URLs
|
89
|
+
$resourceProvider.defaults.stripTrailingSlashes = false;
|
90
|
+
}]);
|
91
|
+
* ```
|
92
|
+
*
|
81
93
|
* @param {string} url A parametrized URL template with parameters prefixed by `:` as in
|
82
94
|
* `/user/:username`. If you are using a URL with a port number (e.g.
|
83
95
|
* `http://example.com:8080/api`), it will be respected.
|
@@ -106,7 +118,7 @@ function shallowClearAndCopy(src, dst) {
|
|
106
118
|
*
|
107
119
|
* @param {Object.<Object>=} actions Hash with declaration of custom action that should extend
|
108
120
|
* the default set of resource actions. The declaration should be created in the format of {@link
|
109
|
-
* ng.$http#
|
121
|
+
* ng.$http#usage $http.config}:
|
110
122
|
*
|
111
123
|
* {action1: {method:?, params:?, isArray:?, headers:?, ...},
|
112
124
|
* action2: {method:?, params:?, isArray:?, headers:?, ...},
|
@@ -155,6 +167,14 @@ function shallowClearAndCopy(src, dst) {
|
|
155
167
|
* `response` and `responseError`. Both `response` and `responseError` interceptors get called
|
156
168
|
* with `http response` object. See {@link ng.$http $http interceptors}.
|
157
169
|
*
|
170
|
+
* @param {Object} options Hash with custom settings that should extend the
|
171
|
+
* default `$resourceProvider` behavior. The only supported option is
|
172
|
+
*
|
173
|
+
* Where:
|
174
|
+
*
|
175
|
+
* - **`stripTrailingSlashes`** – {boolean} – If true then the trailing
|
176
|
+
* slashes from any calculated URL will be stripped. (Defaults to true.)
|
177
|
+
*
|
158
178
|
* @returns {Object} A resource "class" object with methods for the default set of resource actions
|
159
179
|
* optionally extended with custom `actions`. The default set contains these actions:
|
160
180
|
* ```js
|
@@ -330,298 +350,318 @@ function shallowClearAndCopy(src, dst) {
|
|
330
350
|
* ```
|
331
351
|
*/
|
332
352
|
angular.module('ngResource', ['ng']).
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
353
|
+
provider('$resource', function () {
|
354
|
+
var provider = this;
|
355
|
+
|
356
|
+
this.defaults = {
|
357
|
+
// Strip slashes by default
|
358
|
+
stripTrailingSlashes: true,
|
359
|
+
|
360
|
+
// Default actions configuration
|
361
|
+
actions: {
|
362
|
+
'get': {method: 'GET'},
|
363
|
+
'save': {method: 'POST'},
|
364
|
+
'query': {method: 'GET', isArray: true},
|
365
|
+
'remove': {method: 'DELETE'},
|
366
|
+
'delete': {method: 'DELETE'}
|
367
|
+
}
|
341
368
|
};
|
342
|
-
|
369
|
+
|
370
|
+
this.$get = ['$http', '$q', function ($http, $q) {
|
371
|
+
|
372
|
+
var noop = angular.noop,
|
343
373
|
forEach = angular.forEach,
|
344
374
|
extend = angular.extend,
|
345
375
|
copy = angular.copy,
|
346
376
|
isFunction = angular.isFunction;
|
347
377
|
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
378
|
+
/**
|
379
|
+
* We need our custom method because encodeURIComponent is too aggressive and doesn't follow
|
380
|
+
* http://www.ietf.org/rfc/rfc3986.txt with regards to the character set
|
381
|
+
* (pchar) allowed in path segments:
|
382
|
+
* segment = *pchar
|
383
|
+
* pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
|
384
|
+
* pct-encoded = "%" HEXDIG HEXDIG
|
385
|
+
* unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
|
386
|
+
* sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
|
387
|
+
* / "*" / "+" / "," / ";" / "="
|
388
|
+
*/
|
389
|
+
function encodeUriSegment(val) {
|
390
|
+
return encodeUriQuery(val, true).
|
391
|
+
replace(/%26/gi, '&').
|
392
|
+
replace(/%3D/gi, '=').
|
393
|
+
replace(/%2B/gi, '+');
|
394
|
+
}
|
365
395
|
|
366
396
|
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
397
|
+
/**
|
398
|
+
* This method is intended for encoding *key* or *value* parts of query component. We need a
|
399
|
+
* custom method because encodeURIComponent is too aggressive and encodes stuff that doesn't
|
400
|
+
* have to be encoded per http://tools.ietf.org/html/rfc3986:
|
401
|
+
* query = *( pchar / "/" / "?" )
|
402
|
+
* pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
|
403
|
+
* unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
|
404
|
+
* pct-encoded = "%" HEXDIG HEXDIG
|
405
|
+
* sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
|
406
|
+
* / "*" / "+" / "," / ";" / "="
|
407
|
+
*/
|
408
|
+
function encodeUriQuery(val, pctEncodeSpaces) {
|
409
|
+
return encodeURIComponent(val).
|
410
|
+
replace(/%40/gi, '@').
|
411
|
+
replace(/%3A/gi, ':').
|
412
|
+
replace(/%24/g, '$').
|
413
|
+
replace(/%2C/gi, ',').
|
414
|
+
replace(/%20/g, (pctEncodeSpaces ? '%20' : '+'));
|
415
|
+
}
|
386
416
|
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
417
|
+
function Route(template, defaults) {
|
418
|
+
this.template = template;
|
419
|
+
this.defaults = extend({}, provider.defaults, defaults);
|
420
|
+
this.urlParams = {};
|
421
|
+
}
|
392
422
|
|
393
|
-
|
394
|
-
|
395
|
-
|
423
|
+
Route.prototype = {
|
424
|
+
setUrlParams: function (config, params, actionUrl) {
|
425
|
+
var self = this,
|
396
426
|
url = actionUrl || self.template,
|
397
427
|
val,
|
398
428
|
encodedVal;
|
399
429
|
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
430
|
+
var urlParams = self.urlParams = {};
|
431
|
+
forEach(url.split(/\W/), function (param) {
|
432
|
+
if (param === 'hasOwnProperty') {
|
433
|
+
throw $resourceMinErr('badname', "hasOwnProperty is not a valid parameter name.");
|
434
|
+
}
|
435
|
+
if (!(new RegExp("^\\d+$").test(param)) && param &&
|
436
|
+
(new RegExp("(^|[^\\\\]):" + param + "(\\W|$)").test(url))) {
|
437
|
+
urlParams[param] = true;
|
438
|
+
}
|
439
|
+
});
|
440
|
+
url = url.replace(/\\:/g, ':');
|
441
|
+
|
442
|
+
params = params || {};
|
443
|
+
forEach(self.urlParams, function (_, urlParam) {
|
444
|
+
val = params.hasOwnProperty(urlParam) ? params[urlParam] : self.defaults[urlParam];
|
445
|
+
if (angular.isDefined(val) && val !== null) {
|
446
|
+
encodedVal = encodeUriSegment(val);
|
447
|
+
url = url.replace(new RegExp(":" + urlParam + "(\\W|$)", "g"), function (match, p1) {
|
448
|
+
return encodedVal + p1;
|
449
|
+
});
|
450
|
+
} else {
|
451
|
+
url = url.replace(new RegExp("(\/?):" + urlParam + "(\\W|$)", "g"), function (match,
|
452
|
+
leadingSlashes, tail) {
|
453
|
+
if (tail.charAt(0) == '/') {
|
454
|
+
return tail;
|
455
|
+
} else {
|
456
|
+
return leadingSlashes + tail;
|
457
|
+
}
|
458
|
+
});
|
459
|
+
}
|
460
|
+
});
|
431
461
|
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
url = url.replace(/\/\.(?=\w+($|\?))/, '.');
|
437
|
-
// replace escaped `/\.` with `/.`
|
438
|
-
config.url = url.replace(/\/\\\./, '/.');
|
462
|
+
// strip trailing slashes and set the url (unless this behavior is specifically disabled)
|
463
|
+
if (self.defaults.stripTrailingSlashes) {
|
464
|
+
url = url.replace(/\/+$/, '') || '/';
|
465
|
+
}
|
439
466
|
|
467
|
+
// then replace collapse `/.` if found in the last URL path segment before the query
|
468
|
+
// E.g. `http://url.com/id./format?q=x` becomes `http://url.com/id.format?q=x`
|
469
|
+
url = url.replace(/\/\.(?=\w+($|\?))/, '.');
|
470
|
+
// replace escaped `/\.` with `/.`
|
471
|
+
config.url = url.replace(/\/\\\./, '/.');
|
440
472
|
|
441
|
-
// set params - delegate param encoding to $http
|
442
|
-
forEach(params, function(value, key){
|
443
|
-
if (!self.urlParams[key]) {
|
444
|
-
config.params = config.params || {};
|
445
|
-
config.params[key] = value;
|
446
|
-
}
|
447
|
-
});
|
448
|
-
}
|
449
|
-
};
|
450
473
|
|
474
|
+
// set params - delegate param encoding to $http
|
475
|
+
forEach(params, function (value, key) {
|
476
|
+
if (!self.urlParams[key]) {
|
477
|
+
config.params = config.params || {};
|
478
|
+
config.params[key] = value;
|
479
|
+
}
|
480
|
+
});
|
481
|
+
}
|
482
|
+
};
|
451
483
|
|
452
|
-
function resourceFactory(url, paramDefaults, actions) {
|
453
|
-
var route = new Route(url);
|
454
484
|
|
455
|
-
|
485
|
+
function resourceFactory(url, paramDefaults, actions, options) {
|
486
|
+
var route = new Route(url, options);
|
456
487
|
|
457
|
-
|
458
|
-
var ids = {};
|
459
|
-
actionParams = extend({}, paramDefaults, actionParams);
|
460
|
-
forEach(actionParams, function(value, key){
|
461
|
-
if (isFunction(value)) { value = value(); }
|
462
|
-
ids[key] = value && value.charAt && value.charAt(0) == '@' ?
|
463
|
-
lookupDottedPath(data, value.substr(1)) : value;
|
464
|
-
});
|
465
|
-
return ids;
|
466
|
-
}
|
488
|
+
actions = extend({}, provider.defaults.actions, actions);
|
467
489
|
|
468
|
-
|
469
|
-
|
470
|
-
|
490
|
+
function extractParams(data, actionParams) {
|
491
|
+
var ids = {};
|
492
|
+
actionParams = extend({}, paramDefaults, actionParams);
|
493
|
+
forEach(actionParams, function (value, key) {
|
494
|
+
if (isFunction(value)) { value = value(); }
|
495
|
+
ids[key] = value && value.charAt && value.charAt(0) == '@' ?
|
496
|
+
lookupDottedPath(data, value.substr(1)) : value;
|
497
|
+
});
|
498
|
+
return ids;
|
499
|
+
}
|
500
|
+
|
501
|
+
function defaultResponseInterceptor(response) {
|
502
|
+
return response.resource;
|
503
|
+
}
|
504
|
+
|
505
|
+
function Resource(value) {
|
506
|
+
shallowClearAndCopy(value || {}, this);
|
507
|
+
}
|
508
|
+
|
509
|
+
Resource.prototype.toJSON = function () {
|
510
|
+
var data = extend({}, this);
|
511
|
+
delete data.$promise;
|
512
|
+
delete data.$resolved;
|
513
|
+
return data;
|
514
|
+
};
|
471
515
|
|
472
|
-
|
473
|
-
|
474
|
-
}
|
516
|
+
forEach(actions, function (action, name) {
|
517
|
+
var hasBody = /^(POST|PUT|PATCH)$/i.test(action.method);
|
475
518
|
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
Resource[name] = function(a1, a2, a3, a4) {
|
480
|
-
var params = {}, data, success, error;
|
481
|
-
|
482
|
-
/* jshint -W086 */ /* (purposefully fall through case statements) */
|
483
|
-
switch(arguments.length) {
|
484
|
-
case 4:
|
485
|
-
error = a4;
|
486
|
-
success = a3;
|
487
|
-
//fallthrough
|
488
|
-
case 3:
|
489
|
-
case 2:
|
490
|
-
if (isFunction(a2)) {
|
491
|
-
if (isFunction(a1)) {
|
492
|
-
success = a1;
|
493
|
-
error = a2;
|
494
|
-
break;
|
495
|
-
}
|
519
|
+
Resource[name] = function (a1, a2, a3, a4) {
|
520
|
+
var params = {}, data, success, error;
|
496
521
|
|
497
|
-
|
498
|
-
|
522
|
+
/* jshint -W086 */ /* (purposefully fall through case statements) */
|
523
|
+
switch (arguments.length) {
|
524
|
+
case 4:
|
525
|
+
error = a4;
|
526
|
+
success = a3;
|
499
527
|
//fallthrough
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
else if (hasBody) data = a1;
|
509
|
-
else params = a1;
|
510
|
-
break;
|
511
|
-
case 0: break;
|
512
|
-
default:
|
513
|
-
throw $resourceMinErr('badargs',
|
514
|
-
"Expected up to 4 arguments [params, data, success, error], got {0} arguments",
|
515
|
-
arguments.length);
|
516
|
-
}
|
517
|
-
/* jshint +W086 */ /* (purposefully fall through case statements) */
|
518
|
-
|
519
|
-
var isInstanceCall = this instanceof Resource;
|
520
|
-
var value = isInstanceCall ? data : (action.isArray ? [] : new Resource(data));
|
521
|
-
var httpConfig = {};
|
522
|
-
var responseInterceptor = action.interceptor && action.interceptor.response ||
|
523
|
-
defaultResponseInterceptor;
|
524
|
-
var responseErrorInterceptor = action.interceptor && action.interceptor.responseError ||
|
525
|
-
undefined;
|
526
|
-
|
527
|
-
forEach(action, function(value, key) {
|
528
|
-
if (key != 'params' && key != 'isArray' && key != 'interceptor') {
|
529
|
-
httpConfig[key] = copy(value);
|
530
|
-
}
|
531
|
-
});
|
528
|
+
case 3:
|
529
|
+
case 2:
|
530
|
+
if (isFunction(a2)) {
|
531
|
+
if (isFunction(a1)) {
|
532
|
+
success = a1;
|
533
|
+
error = a2;
|
534
|
+
break;
|
535
|
+
}
|
532
536
|
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
537
|
+
success = a2;
|
538
|
+
error = a3;
|
539
|
+
//fallthrough
|
540
|
+
} else {
|
541
|
+
params = a1;
|
542
|
+
data = a2;
|
543
|
+
success = a3;
|
544
|
+
break;
|
545
|
+
}
|
546
|
+
case 1:
|
547
|
+
if (isFunction(a1)) success = a1;
|
548
|
+
else if (hasBody) data = a1;
|
549
|
+
else params = a1;
|
550
|
+
break;
|
551
|
+
case 0: break;
|
552
|
+
default:
|
553
|
+
throw $resourceMinErr('badargs',
|
554
|
+
"Expected up to 4 arguments [params, data, success, error], got {0} arguments",
|
555
|
+
arguments.length);
|
556
|
+
}
|
557
|
+
/* jshint +W086 */ /* (purposefully fall through case statements) */
|
558
|
+
|
559
|
+
var isInstanceCall = this instanceof Resource;
|
560
|
+
var value = isInstanceCall ? data : (action.isArray ? [] : new Resource(data));
|
561
|
+
var httpConfig = {};
|
562
|
+
var responseInterceptor = action.interceptor && action.interceptor.response ||
|
563
|
+
defaultResponseInterceptor;
|
564
|
+
var responseErrorInterceptor = action.interceptor && action.interceptor.responseError ||
|
565
|
+
undefined;
|
566
|
+
|
567
|
+
forEach(action, function (value, key) {
|
568
|
+
if (key != 'params' && key != 'isArray' && key != 'interceptor') {
|
569
|
+
httpConfig[key] = copy(value);
|
551
570
|
}
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
571
|
+
});
|
572
|
+
|
573
|
+
if (hasBody) httpConfig.data = data;
|
574
|
+
route.setUrlParams(httpConfig,
|
575
|
+
extend({}, extractParams(data, action.params || {}), params),
|
576
|
+
action.url);
|
577
|
+
|
578
|
+
var promise = $http(httpConfig).then(function (response) {
|
579
|
+
var data = response.data,
|
580
|
+
promise = value.$promise;
|
581
|
+
|
582
|
+
if (data) {
|
583
|
+
// Need to convert action.isArray to boolean in case it is undefined
|
584
|
+
// jshint -W018
|
585
|
+
if (angular.isArray(data) !== (!!action.isArray)) {
|
586
|
+
throw $resourceMinErr('badcfg',
|
587
|
+
'Error in resource configuration for action `{0}`. Expected response to ' +
|
588
|
+
'contain an {1} but got an {2}', name, action.isArray ? 'array' : 'object',
|
589
|
+
angular.isArray(data) ? 'array' : 'object');
|
590
|
+
}
|
591
|
+
// jshint +W018
|
592
|
+
if (action.isArray) {
|
593
|
+
value.length = 0;
|
594
|
+
forEach(data, function (item) {
|
595
|
+
if (typeof item === "object") {
|
596
|
+
value.push(new Resource(item));
|
597
|
+
} else {
|
598
|
+
// Valid JSON values may be string literals, and these should not be converted
|
599
|
+
// into objects. These items will not have access to the Resource prototype
|
600
|
+
// methods, but unfortunately there
|
601
|
+
value.push(item);
|
602
|
+
}
|
603
|
+
});
|
604
|
+
} else {
|
605
|
+
shallowClearAndCopy(data, value);
|
606
|
+
value.$promise = promise;
|
607
|
+
}
|
568
608
|
}
|
569
|
-
}
|
570
609
|
|
571
|
-
|
610
|
+
value.$resolved = true;
|
572
611
|
|
573
|
-
|
612
|
+
response.resource = value;
|
574
613
|
|
575
|
-
|
576
|
-
|
577
|
-
|
614
|
+
return response;
|
615
|
+
}, function (response) {
|
616
|
+
value.$resolved = true;
|
578
617
|
|
579
|
-
|
618
|
+
(error || noop)(response);
|
580
619
|
|
581
|
-
|
582
|
-
|
620
|
+
return $q.reject(response);
|
621
|
+
});
|
583
622
|
|
584
|
-
|
585
|
-
function(response) {
|
623
|
+
promise = promise.then(
|
624
|
+
function (response) {
|
586
625
|
var value = responseInterceptor(response);
|
587
|
-
(success||noop)(value, response.headers);
|
626
|
+
(success || noop)(value, response.headers);
|
588
627
|
return value;
|
589
628
|
},
|
590
629
|
responseErrorInterceptor);
|
591
630
|
|
592
|
-
|
593
|
-
|
594
|
-
|
595
|
-
|
596
|
-
|
597
|
-
|
631
|
+
if (!isInstanceCall) {
|
632
|
+
// we are creating instance / collection
|
633
|
+
// - set the initial promise
|
634
|
+
// - return the instance / collection
|
635
|
+
value.$promise = promise;
|
636
|
+
value.$resolved = false;
|
598
637
|
|
599
|
-
|
600
|
-
|
638
|
+
return value;
|
639
|
+
}
|
601
640
|
|
602
|
-
|
603
|
-
|
604
|
-
|
641
|
+
// instance call
|
642
|
+
return promise;
|
643
|
+
};
|
605
644
|
|
606
645
|
|
607
|
-
|
608
|
-
|
609
|
-
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
646
|
+
Resource.prototype['$' + name] = function (params, success, error) {
|
647
|
+
if (isFunction(params)) {
|
648
|
+
error = success; success = params; params = {};
|
649
|
+
}
|
650
|
+
var result = Resource[name].call(this, params, this, success, error);
|
651
|
+
return result.$promise || result;
|
652
|
+
};
|
653
|
+
});
|
615
654
|
|
616
|
-
|
617
|
-
|
618
|
-
|
655
|
+
Resource.bind = function (additionalParamDefaults) {
|
656
|
+
return resourceFactory(url, extend({}, paramDefaults, additionalParamDefaults), actions);
|
657
|
+
};
|
619
658
|
|
620
|
-
|
621
|
-
|
659
|
+
return Resource;
|
660
|
+
}
|
622
661
|
|
623
|
-
|
624
|
-
|
662
|
+
return resourceFactory;
|
663
|
+
}];
|
664
|
+
});
|
625
665
|
|
626
666
|
|
627
667
|
})(window, window.angular);
|