remote method name for get and put

30 views
Skip to first unread message

jmls

unread,
Mar 29, 2015, 4:43:30 PM3/29/15
to loopb...@googlegroups.com
I want to be able to add a remote method to handle both a get and a put (similar to get / put on a model)

I can create either one, but can't get both working at the same time using lb-services

NgModel.remoteMethod(
       
'formProperties',
       
{
            accepts
: [
               
{arg: 'modelName', type: 'string'},
               
{arg: 'template', type: 'string'}
           
],
            name
: 'foo',
            description
: 'get form defintions for a model',
            returns
: {arg: 'status', type: 'object'},


            http
: {path: '/:modelName/formProperties', verb: 'get'}
       
});


       
NgModel.remoteMethod(
       
'formPropertiesPut',
       
{
            accepts
: [
               
{arg: 'modelName', type: 'string'},
               
{arg: 'template', type: 'string'},
               
{arg: 'data', type: 'object'}
           
],
            name
: 'foo',
            description
: 'get form defintions for a model',
            returns
: {arg: 'status', type: 'object'},


            http
: {path: '/:modelName/formPropertiesPut', verb: 'put'}
       
});


myModel.formPropertiesPut({modelName: $stateParams.model, data:designer.data}).$promise.then(function(results) {
                console
.log(results)
           
})



a) I presume that I need different methods to handle get and put - otherwise how do I tell lb-services to put on a method instead of get
b) can the http path be the same ?
c) why does the formPropertiesPut lb-services method spit out an error 

PUT http://localhost:60000/api/myModels/formPropertiesPut 404 (Not Found)

thanks

[edit: fixed typo]

Reply all
Reply to author
Forward
0 new messages