2

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
  • 23,286
  • 52
  • 142
  • 260

1 Answers1

3

use unshift method of array:

ractive.unshift('BlogPosts.BlogPostId.Comments', newComment);
Mukund Kumar
  • 17,846
  • 17
  • 53
  • 77