app service MatterTypesService MatterTypes function MatterTypes var se

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
app.service('MatterTypesService', ['$q', 'MatterTypes', function($q, MatterTypes) {
var self = this;
this.matterTypes = {
$promise: $q(function(resolve, reject) {
MatterTypes.query({}, function(data) {
data.forEach(function(matterType) {
self.matterTypes[matterType.slug] = matterType;
});
self.matterTypes.$list = data;
resolve(self.matterTypes);
});
})
};
}]);