0

I know this sort of questions have been answered before also . But I still am not able get completely over it .

Via a server call I am getting a list back. I am trying to get the count of the list by length property.

But it is always undefined.

        $http(request)
            .success(function (response) {
                if (response != "Failed!" && response != "FileAlreadyUploaded") {
                        $scope.pleaseWait = { "display": "none" };

                        console.log("Succeeds");

                        UploadDataServices.setInvalidRecordsCount(response.GroupMembershipInputList.length);

If I see in the browser console , I get to see the property.

enter image description here

What am I doing wrong here ?

4
  • 1
    Possible Duplicate of How do I return the response from an asynchronous call? Commented Jun 8, 2016 at 7:29
  • What's in the setInvalidRecordsCount ? Commented Jun 8, 2016 at 7:30
  • @AnikIslamAbhi .. I am setting the returned length in Angular service variable. Commented Jun 8, 2016 at 7:32
  • @Tushar I am not asking to figure out a way to return from an async call . I am just not understanding why length is undefined even though the array has items within it. So it is not duplicate. Commented Jun 8, 2016 at 7:34

2 Answers 2

1

Try capturing the response in one variable and check the variable value using console.log and if that variable has value try passing the variable instead of the response.

Sign up to request clarification or add additional context in comments.

Comments

1

Sorry guys. It was mistake on my part only . It just happened there was another nested array object with just similar name .. GroupMembershipUploadInputList and that had it's length .

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.