Skip to content

Instantly share code, notes, and snippets.

@JayMc
Created June 30, 2014 03:58
Show Gist options
  • Select an option

  • Save JayMc/d293ac97aef75a1e2375 to your computer and use it in GitHub Desktop.

Select an option

Save JayMc/d293ac97aef75a1e2375 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html ng-app="plunker">
<head>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.14/angular.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/restangular/1.3.1/restangular.min.js" type="text/javascript"></script>
<script data-require="lodash.js@*" data-semver="2.4.1" src="http://cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash.js"></script>
<meta charset="utf-8" />
<title>AngularJS Plunker</title>
<script>document.write('<base href="' + document.location + '" />');</script>
<link rel="stylesheet" href="style.css" />
</head>
<body ng-controller="MainCtrl">
<p>Hello {{name}}!</p>
</body>
</html>
var app = angular.module('plunker', ['restangular']);
app.config(function(RestangularProvider) {
RestangularProvider.setBaseUrl('https://1389350211841.firebaseio.com/restangularTest');
RestangularProvider.setRequestSuffix('.json');
});
app.controller('MainCtrl', function($scope,Restangular) {
$scope.name = 'World';
// First way of creating a Restangular object. Just saying the base URL
var baseAccounts = Restangular.all('accounts');
// This will query /accounts and return a promise.
baseAccounts.getList().then(function(accounts) {
$scope.allAccounts = accounts;
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment