Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Wrong $resource URL when parameter is int==0 #1212

Closed
@bonya

Description

@bonya

If resource.userId === 0

$resource('/users/:userId/', {}, {save: {method: 'POST'}}).$save() 

calls the wrong url '/users' instead of '/users/0' since userId === 0 is treated as false during uri segment encoding.

I believe it should be checked agains 'undefined' and null instead.

Version 1.0.1
File: angular-resource.js (292)
encodedVal = encodeUriSegment(params[urlParam] || self.defaults[urlParam] || "");

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions