1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
| app.factory('categoriesService', ['$firebaseArray', 'FIREBASE_URI', function ($firebaseArray, FIREBASE_URI) {
var ref = new Firebase(FIREBASE_URI);
var categories = $firebaseArray(ref.child('categEmployes'));
var getCategories = function () {
return categories;
};
var ajouterCategorie = function (categorie) {
categories.$add(categorie);
};
var majCategorie = function (id) {
categories.$save(id);
};
var supprimerCategorie = function (id) {
categories.$remove(id);
};
return {
getCategories: getCategories,
ajouterCategorie: ajouterCategorie,
majCategorie: majCategorie,
supprimerCategorie: supprimerCategorie
}
}]) |
Partager