Skip to content

Instantly share code, notes, and snippets.

@NicholasMurray
Last active August 29, 2015 14:21
Show Gist options
  • Select an option

  • Save NicholasMurray/d4c16a38f65489d01c6a to your computer and use it in GitHub Desktop.

Select an option

Save NicholasMurray/d4c16a38f65489d01c6a to your computer and use it in GitHub Desktop.
var app = angular.module("app",[]);
app.factory("customerService", function () {
app.factory("customerService", function () {
var customers = [
{
firstname: "Joe",
lastname: "Bloggs"
},
{
firstname: "Jane",
lastname: "Doe"
}
];
return {
customers
};
});
app.service("userService", function () {
var users = [
{
firstname: "A",
lastname: "User"
},
{
firstname: "Any",
lastname: "Body"
}
];
this.users = users;
});
app.controller("customersController", function($scope, customerService) {
$scope.customers = customerService.customers;
});
app.controller("usersController", function($scope, userService) {
$scope.users = userService.users;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment