Dismiss
Announcing Stack Overflow Documentation

We started with Q&A. Technical documentation is next, and we need your help.

Whether you're a beginner or an experienced developer, you can contribute.

Sign up and start helping → Learn more about Documentation →

Can any one tell me how to parse this API using Angular. I want to get all unis array elements.

$http.get('https://www.coursera.org/maestro/api/topic/list2').success(function(data)
{
    console.log("UniCtrl:" + data.unis);
    $scope.unis = data.unis;
});

But data.unis is showing as undefind.

share|improve this question
    
You might have to parse data as JSON. – Bibhas Jan 4 '14 at 8:55
    
@Bibhas thanx, can you tell me how. – ARV Jan 4 '14 at 9:03
    
hmm, that api return content-type application/json it should automatically parse json data though. – YOU Jan 4 '14 at 9:05
    
@YOU I can't fetch the output from terminal because of SSL error. Is it possible that data is not being returned for the same reason? – Bibhas Jan 4 '14 at 9:07
1  
If there is no public api, you need middle layer, that fetch that json from server like php or python and that pass data through to your web. – YOU Jan 4 '14 at 10:50
$http.jsonp('https://www.coursera.org/maestro/api/topic/list2').success(function(data) {
    JSON.parse(data); // to parse it
    console.log(data); // to see what it returns
    $scope.unis = data.unis;
});
share|improve this answer
    
@decodesmith not working giving error Uncaught SyntaxError: Unexpected token : – ARV Jan 4 '14 at 10:35
    
looking into it :) – dcodesmith Jan 4 '14 at 10:39

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.