0

How can I access signatures of, say 0 or 1 in the picture.

I know I can get to values by objname.$$state.value which returns the [[], []], but how can I access say the signatures?

The list shown is what comes up if I click the Object shown in the console by console.log(objname);, Also, objname is a AngularJS deferred promise object I returned.

enter image description here

1 Answer 1

1

You need to add below code your promise success code, so that the code shouldn't get failed. You need to loop through the object objname.$$state.value then again the inner forEach will give you access to signatures

CODE

var allSignatures = [];
angular.forEach(`objname.$$state.value`, function(value, index){
   angular.forEach(value, function(v, i){
       allSignatures.push(v.signatures);
   });
});
Sign up to request clarification or add additional context in comments.

5 Comments

that just makes an empty array :(
need to look at your code, probably you are executing this code before promise gets resolved...
While your answer was helpful, the problem was that the .then's first argument is a function and it has to take a parameter which I didn't set, rookie mistake - but you did answer the initial question, thanks.
@JahanzebKhan Actually i did mention in answer, you should run this code block, when your promise resolved, anyways glad to hear that it does helped you, Thanks :)
I meant I was writing .then(function () {...}) and I needed .then(function (objname) {...}) :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.