Add createMany method which posts multiple objects on strongloop api using loopback services

$resourceProvider.defaults.actions['yourCreateMany'] = {'method':'POST','isArray':true};

Recently I was trying to post multiple objects to strongloop api using angular loopback sdk services. There was error for doing so, “callback expects object received array”. This can be handled by setting

'isArray':true

in reource model, but as the loopback services file was getting generated on the fly I could not update the loopback services js file.

I have extended $resourceProvider default actions for my app, it worked., Hope you find it useful.

Advertisements

One thought on “Add createMany method which posts multiple objects on strongloop api using loopback services

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s