-
-
Save barbagrigia/71fd70187eafd2296a89b9b972eedb55 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
angular | |
.module('PersonMod', []) | |
.factory('Person', function () { | |
function Person() {}; | |
Person.create = function (data) { | |
return new Person(data); | |
}; | |
return Person; | |
}) | |
.service('PersonLoader', [function() { | |
return $http.get('/person') | |
}]) |
This file contains hidden or 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
define([ | |
'../factories/Person.js', | |
'../services/PersonLoader.js' | |
], function (Person, PersonLoader) { | |
return angular | |
.module('PersonMod', []) | |
.factory('Person', Person) | |
.service('PersonLoader', PersonLoader) | |
.name; | |
}) |
This file contains hidden or 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
define([ | |
'../factories/Person.js', | |
'../services/PersonLoader.js' | |
], function (Person, PersonLoader) { | |
'use strict'; | |
return PersonLoder.get() | |
.then(function (people) { | |
return people.map(Person.create); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment