Permalink
Browse files

fixed bug that printed the whole array on each item added, in order t…

…o print just the last item
  • Loading branch information...
1 parent b0baff0 commit 2b9287781f46000f26a49bd889da1f6e86e4f09d @timkg timkg committed Mar 3, 2012
Showing with 2 additions and 2 deletions.
  1. +2 −2 book/index.html
View
@@ -2090,7 +2090,7 @@ <h1 id="detailedobserver">The Observer (Pub/Sub) pattern</h1>
if(userName.length){
userList.push({user: userName});
- $( "#userTemplate" ).tmpl( userList ).appendTo( "#users" );
+ $( "#userTemplate" ).tmpl( userList[userList.length - 1] ).appendTo( "#users" );
}
});
@@ -2101,7 +2101,7 @@ <h1 id="detailedobserver">The Observer (Pub/Sub) pattern</h1>
if(movieTitle.length){
movieList.push({ movie: movieTitle, rating: userRating});
- $( "#ratingsTemplate" ).tmpl( movieList ).appendTo( "#ratings" );
+ $( "#ratingsTemplate" ).tmpl( movieList[movieList.length - 1] ).appendTo( "#ratings" );
}
});

0 comments on commit 2b92877

Please sign in to comment.