A
A
Abc Edc2015-01-25 09:24:57
Angular
Abc Edc, 2015-01-25 09:24:57

How to pass put request from angular/jquery to nodejs?

Recently it dawned on me that I use express a little incorrectly and so I decided to ask how to send put, do I understand it correctly, as it were, points to insert ?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Artur Bekerov, 2015-01-25
@gleber1

Using the Comments example, specify this in services.js

crmServices.factory('Comments', ['$resource',
    function ($resource) {
        return $resource('api_v3/public/comments/:id', {id: '@id'}, {
            get: {method: 'GET', isArray: false},
            query: {method: 'GET', isArray: true},
            save: {method: 'POST'},
            delete: {method: 'DELETE'},
            update: {method: 'PUT'}
        });
    }]);

And in controller.js
Comments.update({}, $scope.comment, function (res) {
                        console.log(res);
                    }
                );

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question