5

I've been using the following code to add new comment to the end of the list:

 ractive.push('BlogPosts.BlogPostId.Comments', newComment);

But now I need to add an item to the beginning of the list. I've looked through ractive documentation but did not succeed in finding the appropriate method.

SiberianGuy
  • 24,674
  • 56
  • 152
  • 266

1 Answers1

3

use unshift method of array:

ractive.unshift('BlogPosts.BlogPostId.Comments', newComment);
Mukund Kumar
  • 21,413
  • 18
  • 59
  • 79