fix($resource): prevent URL template from collapsing into an empty string

if url template would result in an empty string, we should make a request
to '/' instead.

Closes #5455
Closes #5493