@@ -519,7 +519,10 @@ angular.module('ngResource', ['ng']).
519
519
forEach = angular . forEach ,
520
520
extend = angular . extend ,
521
521
copy = angular . copy ,
522
- isFunction = angular . isFunction ;
522
+ isArray = angular . isArray ,
523
+ isDefined = angular . isDefined ,
524
+ isFunction = angular . isFunction ,
525
+ isNumber = angular . isNumber ;
523
526
524
527
/**
525
528
* We need our custom method because encodeURIComponent is too aggressive and doesn't follow
@@ -595,7 +598,7 @@ angular.module('ngResource', ['ng']).
595
598
params = params || { } ;
596
599
forEach ( self . urlParams , function ( paramInfo , urlParam ) {
597
600
val = params . hasOwnProperty ( urlParam ) ? params [ urlParam ] : self . defaults [ urlParam ] ;
598
- if ( angular . isDefined ( val ) && val !== null ) {
601
+ if ( isDefined ( val ) && val !== null ) {
599
602
if ( paramInfo . isQueryParamValue ) {
600
603
encodedVal = encodeUriQuery ( val , true ) ;
601
604
} else {
@@ -673,11 +676,11 @@ angular.module('ngResource', ['ng']).
673
676
forEach ( actions , function ( action , name ) {
674
677
var hasBody = / ^ ( P O S T | P U T | P A T C H ) $ / i. test ( action . method ) ;
675
678
var numericTimeout = action . timeout ;
676
- var cancellable = angular . isDefined ( action . cancellable ) ? action . cancellable :
677
- ( options && angular . isDefined ( options . cancellable ) ) ? options . cancellable :
679
+ var cancellable = isDefined ( action . cancellable ) ? action . cancellable :
680
+ ( options && isDefined ( options . cancellable ) ) ? options . cancellable :
678
681
provider . defaults . cancellable ;
679
682
680
- if ( numericTimeout && ! angular . isNumber ( numericTimeout ) ) {
683
+ if ( numericTimeout && ! isNumber ( numericTimeout ) ) {
681
684
$log . debug ( 'ngResource:\n' +
682
685
' Only numeric values are allowed as `timeout`.\n' +
683
686
' Promises are not supported in $resource, because the same value would ' +
@@ -768,11 +771,11 @@ angular.module('ngResource', ['ng']).
768
771
769
772
if ( data ) {
770
773
// Need to convert action.isArray to boolean in case it is undefined
771
- if ( angular . isArray ( data ) !== ( ! ! action . isArray ) ) {
774
+ if ( isArray ( data ) !== ( ! ! action . isArray ) ) {
772
775
throw $resourceMinErr ( 'badcfg' ,
773
776
'Error in resource configuration for action `{0}`. Expected response to ' +
774
777
'contain an {1} but got an {2} (Request: {3} {4})' , name , action . isArray ? 'array' : 'object' ,
775
- angular . isArray ( data ) ? 'array' : 'object' , httpConfig . method , httpConfig . url ) ;
778
+ isArray ( data ) ? 'array' : 'object' , httpConfig . method , httpConfig . url ) ;
776
779
}
777
780
if ( action . isArray ) {
778
781
value . length = 0 ;
@@ -803,7 +806,7 @@ angular.module('ngResource', ['ng']).
803
806
promise [ 'finally' ] ( function ( ) {
804
807
value . $resolved = true ;
805
808
if ( ! isInstanceCall && cancellable ) {
806
- value . $cancelRequest = angular . noop ;
809
+ value . $cancelRequest = noop ;
807
810
$timeout . cancel ( numericTimeoutPromise ) ;
808
811
timeoutDeferred = numericTimeoutPromise = httpConfig . timeout = null ;
809
812
}
0 commit comments