Guest User

Untitled

a guest
Dec 11th, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. import Ember from 'ember';
  2. import { computed } from '@ember/object';
  3.  
  4. export default Ember.Controller.extend({
  5. appName: 'Ember Twiddle',
  6. items: [
  7. { firstName: 'Max', lastName: 'Mustermann', email: 'mustermann@examples.com' },
  8. { firstName: 'Sven', lastName: 'Adam', email: 'sven@examples.com' },
  9. { firstName: 'Karl', lastName: 'Käfer', email: 'karl@examples.com' },
  10. ],
  11. filteredItems: computed('filterFirstName', 'filterLastName', 'filterEmail', 'items.[]', function() {
  12. return this.items.filter((item) => {
  13. return (!this.filterFirstName || item.firstName.includes(this.filterFirstName)) &&
  14. (!this.filterLastName || item.lastName.includes(this.filterLastName)) &&
  15. (!this.filterEmail || item.email.includes(this.filterEmail));
  16. });
  17. }),
  18. });
Add Comment
Please, Sign In to add comment