How to implement Restangular in a MEAN.js application?


I would like to figure out how to implement Restangular in my mean.js application, i’m doing the routing with angular.js, and i’m using espress.js for the RESTAPI, what i want is to consume the API with Restangular.

These are some of my express routes:

module.exports = (function () {

    var express        = require( 'express' ),
        router         = express.Router(),
        create_product = require( './create-product.controller' ),
        list_product   = require( './list-product.controller' ),
        detail_product = require( './detail-product.controller' ),
        update_product = require( './update-product.controller' );

    router.route( '/purchases/products/new' )
        .post( );

    router.route( '/purchases/products/list' )
        .get( list_product.get );

    router.route( '/purchases/products/:id/detail' )
        .get( detail_product.get );

    router.route( '/purchases/products/:id/update' )
        .put( update_product.put );

    return router;


When using $http i would do:

$http.get('/purchases/products/list').then(successCallback, errorCallback);

$'/purchases/products/1/update', {name: 'Eggs', description: 'White'}).then(successCallback, errorCallback);

How could i do that using Restangular?


I dont know if you actually read the documentation but




Same for post


Answered By – Milos Mosovsky

Answer Checked By – David Goodson (AngularFixing Volunteer)

Leave a Reply

Your email address will not be published.