Get started with restangular CDN

MIT licensed

AngularJS service, Restangular: simplifies REST API CRUD operations with fluent interface.

Tags:
  • angular
  • client
  • browser
  • restful
  • resources
  • rest
  • api

Stable version

Copied!

How to start using restangular CDN


<!DOCTYPE html>
<html>
<head>
  <script src="https://cdn.jsdelivr.net/npm/angular@1.7.9/angular.min.js"></script>
  <script src="https://cdn.cdnhub.io/restangular/1.6.0/restangular.min.js"></script>
  <script src="app.js"></script>
</head>
<body ng-app="myApp">
  <div ng-controller="MyController">
    <button ng-click="fetchData()">Fetch Data</button>
    <ul>
      <li ng-repeat="item in data">{{ item.name }}</li>
    </ul>
  </div>
</body>
</html>

// app.js
angular.module('myApp', ['restangular'])
  .controller('MyController', ['$scope', 'Restangular', function($scope, Restangular) {
    const restangular = Restangular.withConfig(function(RestangularProvider) {
      RestangularProvider.setBaseUrl('/api');
    });

    $scope.fetchData = function() {
      restangular.all('items').getList().then(function(items) {
        $scope.data = items;
      });
    };
  }]);
Copied!
Copied!

All versions