Skip to content

Instantly share code, notes, and snippets.

@marufsiddiqui
Last active December 17, 2015 14:39
Show Gist options
  • Save marufsiddiqui/5625826 to your computer and use it in GitHub Desktop.
Save marufsiddiqui/5625826 to your computer and use it in GitHub Desktop.
A Sample AngularJS Service using the factory way
var shoppingModule = angular.module('ShoppingModule', []);
shoppingModule.factory('Items', function () {
var items = {};
items.query = function () {
return [
{title: 'Paint pots', description: 'Pots full of paint', price: 3.95},
{title: 'Polka dots', description: 'Dots with polka', price: 2.95},
{title: 'Pebbles', description: 'Just little rocks', price: 6.95}
]
};
return items;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment