Well yes function is a member of scope for example that is passed to some child component as attribute.
Say I have function that should return some filtred items, and also I want to execute some action on this items.
- scope: {
- filteredItems: function(){
- var filtered = this.items.filter(function(){...})
- // some additioal action that touches item's attributes but I don't want this changes to be handled by filteredItems
- filtered.forEach(function(){...})
- return filtered
- }
- }
Actually this is solved by definining filtredItems as attribute with define.get
- scope: {
- define: {
- fiteredItems: {
- get: function(){
- return this.items.filter(function(){...})
- }
- }
- }
- },
- events: {
- '{scope} filteredItems': function(scope, ev, filtered){
- // some additioal action
- filtered.forEach(function(){...})
- }
- }
I just thought maybe first variant could be accomplished somehow.