2017  Kodetalk | Feedback | Privacy Policy | Terms | About

Using ng-repeat on a JSON object doesn't work - why?

I can"t seem to iterate over a JSON object using ng-repeat. I did test it directly by index and it works, but just can"t seem to loop and print. What am I doing wrong?

Here"s my code:

<div ng-app="myApp">  
<div ng-controller="Ctrl">  
     <h3>Upcoming Events</h3>     
     <ul ng-repeat="event in events">         
        <li>{{ event.feed.entry.title.$t }}</li>            
 <!-- testing single entry here - it works! -->    
 <small>{{ events.feed.entry[0].title.$t }}</small> 

The script:

var app = angular.module("myApp", []); 
var feedUrl = "https://www.google.com/calendar/feeds/ogmda.com_89pas0l9jbhpf053atd83hdj30%40group.calendar.google.com/publi                c/basic?alt=json";  
app.controller("Ctrl", function($http, $scope) {
     $http.get(feedUrl).success(function(data) {  
           $scope.events = data;    
That's because you iterate over the whole data returned by the calendar query, and not over the entries themselves. Change your ul to:

<ul ng-repeat="entry in events.feed.entry">
    <li>{{ entry.title.$t }}</li>    

Answer is