Last active
December 8, 2015 17:53
-
-
Save awilson28/443bc354599425b9b891 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
app.factory('AlbumFactory', function(DS){ | |
var AlbumFactory = DS.defineResource({ | |
basePath: 'api', | |
name: 'albums', | |
idAttribute: '_id', | |
methods: { | |
raw: function(){ | |
return 'api/albums/'+ this._id + '.image' | |
} | |
} | |
}) | |
return AlbumFactory; | |
}) | |
.controller('AlbumController', function(AlbumFactory){ | |
// GET to 'api/albums' | |
AlbumFactory.findAll() | |
.then(function(albums){ | |
var firstAlbum = albums[0] | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment