angular.module('etsyCatalog', [ 'restangular' ])
.controller('MainController', [ 'Restangular', function(Restangular){
Restangular.setBaseUrl('/path/to');
this.products = Restangular.all('products').getList().$object;
// `$object` is an empty `Array` that is filled with data on success
} ])
; // END module(etsyCatalog)
[ ] Custom Services
You can define your own Services for injection!
Just use angular.factory (angular.service is confusing):
angular.module('etsyCatalog', [ 'restangular' ])
.factory('Products', [ 'Restangular', function(Restangular){
Restangular.setBaseUrl('/path/to'); // We might repeat this a little...
return Restangular.service('products');
} ])
.controller('MainController', [ 'Products', function(Products){
this.products = Products.getList().$object;
} ])
; // END module(etsyCatalog)
[x] Getting Data and Dependency Injection
jQuery.get()
here...$http
service...$http
service to get data:self
as an alias forthis
... ick.Restangular
:[ ] Custom Services
angular.factory
(angular.service
is confusing):