How to write Mobile Apps for LoopBack Applications

With the Node.js API framework LoopBack you can easily provide REST APIs for your applications. In order to build client applications LoopBack provides an AngularJS JavaScript SDK. The same SDK can be used to build web frontends and mobile apps. Below is an example how to develop mobile apps via AngularJS, Ionic and Cordova.

Download the sample application from GitHub.

In AngularJS applications you typically build views that interact with services via controllers. The services access data from the server-side applications. Obviously you can write your own services which invoke the REST APIs of your LoopBack applications directly. But LoopBack makes this even simpler via the AngularJS SDK. With the SDK client side JavaScript libraries are generated for your REST APIs so that the controllers can simply invoke JavaScript APIs rather than REST APIs.

The sample application demonstrates how to build mobile apps for a simple Approval Request scenario. Approval requests have titles, descriptions, requesters and approvers. Via Cordova the apps run as hybrid mobile apps on Android and iOS.


Here is the code snippet of the controller that returns all approval requests. The class ApprovalRequest is provided by the LoopBack SDK. Note that the code of the controller is identical to the controllers used in web applications.

angular.module('angularApp').controller('RequestsController', ['$scope', 'ApprovalRequest', function($scope, ApprovalRequest) {
  $scope.requests = [];
  function getRequests() {
        .then(function(results) {
          $scope.requests = results;
        function(err) {
          $scope.requestsError = err.statusText;

For details check out the sample on GitHub.

One thought on “How to write Mobile Apps for LoopBack Applications

  1. Don Lam says:

    Hi @Niklas Heidloff,

    How fine grained is loopback’s ACL? Can it restrict modification access to specific properties in an object?

    For example, a collaboration application between users, where the object to be modify is an issue’s resolution status that may look like this:

    { id: “id”,
    “task_creator”: “creater_name”,
    “status”: “open”,
    “request_status”: “done”

    Is it possible to allow a second user who is not the creator of the model to modify only the “request_status” property because we want the app to prevent another user from setting the task to “complete” before it is approved by the task creator?

Leave a Reply