Created
December 23, 2016 00:10
-
-
Save averydev/9b7927dd434481a519c968eb298e47ac to your computer and use it in GitHub Desktop.
How can this be refactored?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//controller | |
filtered: Ember.computed('filterFn', function (){ | |
return this.get('filterFn')(this.get('allProducts')) | |
}, | |
actions:{ | |
updateFilter: function (newFilterFn){ | |
this.set('filterFn', newFilterFn) | |
} | |
//template | |
{{filter-component | |
updateFilter=(action 'updateFilter') | |
}} | |
//Component Js | |
onUpdateFilter: Ember.observer('propertyA', 'propertyB', 'propertyC', function (){ | |
var newFilterMethod = //...construct filtering method based on properties | |
this.get('updateFilter')(newFilterMethod) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The only idea I have is to put an
action="updateFilter" on="change"
on every input.