File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -392,7 +392,7 @@ angular.module('ngResource', ['ng']).
392392 actionParams = extend ( { } , paramDefaults , actionParams ) ;
393393 forEach ( actionParams , function ( value , key ) {
394394 if ( isFunction ( value ) ) { value = value ( ) ; }
395- ids [ key ] = value . charAt && value . charAt ( 0 ) == '@' ? getter ( data , value . substr ( 1 ) ) : value ;
395+ ids [ key ] = value && value . charAt && value . charAt ( 0 ) == '@' ? getter ( data , value . substr ( 1 ) ) : value ;
396396 } ) ;
397397 return ids ;
398398 }
Original file line number Diff line number Diff line change @@ -205,6 +205,16 @@ describe("resource", function() {
205205 } ) ;
206206
207207
208+ it ( 'should not throw TypeError on null default params' , function ( ) {
209+ $httpBackend . expect ( 'GET' , '/Path?' ) . respond ( '{}' ) ;
210+ var R = $resource ( '/Path' , { param : null } , { get : { method : 'GET' } } ) ;
211+
212+ expect ( function ( ) {
213+ R . get ( { } ) ;
214+ } ) . not . toThrow ( ) ;
215+ } ) ;
216+
217+
208218 it ( 'should handle multiple params with same name' , function ( ) {
209219 var R = $resource ( '/:id/:id' ) ;
210220
You can’t perform that action at this time.
0 commit comments