Last active
December 17, 2015 14:39
-
-
Save marufsiddiqui/5625826 to your computer and use it in GitHub Desktop.
A Sample AngularJS Service using the factory way
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
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