I'm trying to display 1 of the 2 arrays, this is my factory:
App.factory('NieuwsService', ['BERKVENS_NIEUWS', 'SVEDEX_NIEUWS', function (BERKVENS_NIEUWS, SVEDEX_NIEUWS) {
var nieuwsService = {};
var _nieuws = [];
var _loadNieuws = function (url) {
switch (url) {
case 'berkvens':
_nieuws = BERKVENS_NIEUWS;
break;
case 'svedex':
_nieuws = SVEDEX_NIEUWS;
break;
}
}
nieuwsService.loadNieuws = _loadNieuws;
nieuwsService.nieuws = _nieuws;
return nieuwsService;
}]);
This is the code of my controller:
App.controller('instellingenCtrl', function ($scope, NieuwsService) {
var url = 'berkvens';
angular.copy(NieuwsService.loadNieuws(url));
$scope.message= NieuwsService.nieuws[1].title;
});
But it wouldn't work.
So how do I choose that I want the array 'berkvens' and how do I show it then ?
BERKVENS_NIEUWSvalue in your questions.