Skip to content

Instantly share code, notes, and snippets.

@mbritton
Created March 3, 2014 20:22
Show Gist options
  • Select an option

  • Save mbritton/9333781 to your computer and use it in GitHub Desktop.

Select an option

Save mbritton/9333781 to your computer and use it in GitHub Desktop.
/**
* Provides a CRUD interface to People
*/
app.factory('servicePeople', function ($rootScope) {
var peopleData = {
people: [
{
personID:1,
departmentID:4,
firstName:'John',
lastName:'Lennon',
phone:'',
email:'',
image:'images/appointment_john.png'
},
{
personID:2,
departmentID:3,
firstName:'Paul',
lastName:'McCartney',
phone:'',
email:'',
image:'images/appointment_paul.png'
},
{
personID:3,
departmentID:2,
firstName:'George',
lastName:'Harrison',
phone:'',
email:'',
image:'images/appointment_george.png'
},
{
personID:4,
departmentID:1,
firstName:'Ringo',
lastName:'Starr',
phone:'',
email:'',
image:'images/appointment_ringo.png'
},
]
};
peopleData.getPersonByID = function(id) {
var pers;
$.each(this.people, function(index, itm) {
if (itm.personID == id) {
pers = itm;
}
});
return pers;
};
return peopleData;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment