I am trying to return a JSON object in my AngularJS application. I have a list of links, I have to pass them one by one, append them to an iniatal link and then grab the json file and display it.
So far even trying with one link doesn't display any result.
This is my controller:
(function () {
'use strict';
angular.module('index')
.filter('resolve', function () {
return function (x, $http) {
$http.get('http://FirstPartOfTheUrl.com' + x)
.success(function (data) {
return data;
})
.error(function () {
return 'Error Message';
});
}
}
})
.controller('indexController', function ($scope, $http) {
$scope.test = 'https://theUrlIHaveToAppend.com'
})();
and this is in my HTML
<div ng-controller="indexController">
{{test | resolve}}
</div>
displaying the page just returns {{test | resolve}}
bare in mind if i try just to print the appended url it does display the correct url and if I click on that I can actually get the file. I tried AJAX and asynchronous functions but the problem remains.
as for the recursion I will apply an ng-repeat in the div but I need this to work first.
Thanks