SHARE
TWEET

Untitled

a guest Mar 21st, 2017 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import Ember from 'ember';
  2.  
  3. export default Ember.Component.extend({
  4.  
  5.   postsFiltered: Ember.computed('category', 'search', function () {
  6.    
  7.     var posts = this.get('posts');
  8.     var search = this.get('search');
  9.    
  10.     console.log('computed postsFiltered() with category: ' + this.get('category') + ', search: ' + search);
  11.     return posts.filter((item) => item['categoryId'] === this.get('category'));
  12.    
  13.     // or this when I search, but I don't know how to do:
  14.     // return posts.filter((item) => item['name'].includes(search))
  15.   })
  16. });
RAW Paste Data
Top