Created
August 5, 2016 17:20
-
-
Save Couto/27f0d2ecb39b910d0ea53e8127d26661 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