i have an json array like this
//data.json
{
"one": [ {"name":"john"},{"name":"joe"},{"name":"vicky"} ],
"two": [ {"name":"mark"},{"name":"nike"},{"name":"albert"} ]
}
//filter.js
angular.module('eventFilters', ['calenderServices']).filter('compare', function(Name) {
var e=Name.query();
return function(input) {
alert(e['one'].length) //-->displays nothing
}
i am trying to retrieve the length of the array "one" and "two", but jsondata['one'].length is not returning the length, it is not displaying any thing. My angular restful services which i have used to get the json data from external file is correct, no doubt in that. since i am getting json data in filter, i couldn't use $scope.e=Name.query(); so i tried using 'var', it was working fine with my old json data, but not with my new json file. what may be the problem?
Thanks in advance