-
-
Save machty/7781260 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
FooController = Em.Controller.extend({ | |
queryParamBindings: ['bar'], // maps to foo[bar] | |
bar: 'baz', | |
widgets: Ember.computed.sort('content', 'bar') | |
}); | |
FooController = Em.Controller.extend({ | |
queryParamBindings: ['bar:lalal'], // maps to lalal | |
bar: 'baz', | |
// it should be very rare to have to configure this, | |
// but we need some hook to enable pushState changes | |
historyType: function(paramName, value) { | |
if (paramName) { | |
return HISTORY.REPLACE_STATE; | |
} | |
} | |
}) | |
FooRoute = Em.Route.extend({ | |
model: function(params) { | |
// all params | |
return getAThing(params); | |
}, | |
actions: { | |
// There is a default implementation of queryParamsDidChange, | |
// see below. | |
queryParamsDidChange: function(changedParams){ | |
this.refresh(); | |
} | |
} | |
}); | |
FooRoute = Em.Route.extend({ | |
refreshOnQueryParamChanges: ['bar', /^foo/] | |
model: function(params) { | |
return FooDataAccess.retrieveFoos(paramsToFooSelectionData); | |
}, | |
}); | |
Em.Route#refresh // schedules re-run of the model hooks of this route | |
// which the run loop coalesces to refresh routes in an intelligent order (root-iest on down to leaf-iest) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment