Generator API


Generate Angular $resource services for the given loopback application.

var generateServices = require('loopback-sdk-angular').services;
var app = require('./server/server');

var client = generateServices(app, {
  ngModuleName: 'lbServices',
  apiUrl: '/api'
require('fs').writeFileSync('client/loopback.js', client, 'utf-8');

To preserve backwards compatibility, the three-arg variant is still supported:

var client = generateServices(app, 'lbServices', '/api');
Name Type Description
app Object

The loopback application created via app = loopback().

options Object
ngModuleName string

A name for the generated Angular module. Default: lbServices.

apiUrl string

The URL where the client can access the LoopBack server app. Default: /.

includeSchema Boolean

Include model definition.

Name Type Description
result string

The generated javascript code.

Angular Client API