Sometimes we need to display a filtered version of an array without actually mutating or resetting the original data. In our example, we want to display a list with the stories written by Alex and one list with the stories written by John. We can achieve this by using the built-in filter, filterBy
:
<html> <head> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"> <title>User Stories</title> </head> <body> <div class="container"> <h1>Let's hear some stories!</h1> <div> <h3>Alex's stories</h3> <ul class="list-group"> <li v-for="story in stories | filterBy 'Alex' in 'writer'" class="list-group-item" > {{ story.writer }} said "{{...