I have written a service in AngularJS, but I don't use the service in my controller.
Service.js
var appService = angular.module("appService", []);
appService.service("bddService", function() {
var bdds = bdd;
this.getBdds = function(){
return bdds;
};
var bdd = [{
id : 1,
nom : "Activité commercial",
desc : "Information de l'activité commercial de l'entreprise Bou."
}];
});
Controller.js
(function(){
var accueilCtrl = angular.module("accueilCtrl", ['appService']);
accueilCtrl.controller('accueilCtrl', ['$scope', 'bddService', function($scope, bddService){
$scope.bdds = bddService.getBdds(); // No error, but no data
}]);
})();
There are two files, if I put the code in the same file it works (Service injection into controller with AngularJS). The console doesn't display errors.