Saturday, 15 August 2015

ember.js - EmberJS override route filter without global -



ember.js - EmberJS override route filter without global -

i have listroute can used standalone or overridden filter method.

currently overriding route accesses global variable. i'm trying rid of globals don't see way pass context along function.

how can pass context along (in case 'currentuser') without globals. or how should rewrite this.

why 'this' in extending function window? hoping i'd able @ to the lowest degree phone call this.modelfor() access necessary information.

encompass.workspaceslistroute = ember.route.extend({ controllername: 'workspaces.list', templatename: 'workspaces/list', filter: function(workspace) { homecoming true; //return default, extenders override }, model: function() { var store = this.get('store'); homecoming store.filter('workspace', this.get('filter')); }, }); encompass.workspacesmineroute = encompass.workspaceslistroute.extend({ filter: function(workspace) { //at point 'this' window (why not route?) homecoming (encompass.get('currentuser') === workspace.get('owner')); } });

i believe calling getter takes out of scope in terms of functional scope. should able passing in this.filter.

http://emberjs.jsbin.com/lunitoyi/1/edit

ember.js ember-data

No comments:

Post a Comment