1

In the controller,

$scope.save = function(obj) {
    restService.save(
        {table: "relations", id: obj.id}, obj
    )
}

In the service,

.service('restService', ['$resource', function($resource){
    var prefixUrl = "http://localhost:4507/v1/rest";
        {
            table: "@table",
            id: "@id"
        },
        {
            query: {
                method: "GET",
            },
            save: {
                method: "PUT",
            },
            delete: {
                method: "DELETE",
            }
        }
    );
}])

When I call save, with integer value changed within obj, it's automatically converted to string.

You can see news_count: 0 You can see news_count: "120"

You can see news_count: 0 in the first picture, but when I change it's value to 120 and make a request again, $resource seems to change it to "120" instead of 120.

Why is this happening?

1

1 Answer 1

0

Is "obj" binded with ? Value from should be always string.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.