Created
December 4, 2013 02:26
-
-
Save lukemelia/7781252 to your computer and use it in GitHub Desktop.
Sketches for Ember query param support
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'], | |
bar: 'baz', | |
widgets: Ember.computed.sort('content', 'bar') | |
}) | |
FooController = Em.Controller.extend({ | |
queryParamBindings: ['bar:barbados'], | |
bar: 'baz', | |
historyType: function(paramName, value) { | |
if (paramName) { | |
return HISTORY.REPLACE_STATE; | |
} | |
} | |
}) | |
FooRoute = Em.Route.extend({ | |
model: function(params) { | |
return FooDataAccess.retrieveFoos(paramsToFooSelectionData); | |
}, | |
actions: { | |
queryParamsDidChange: function(){ | |
this.refresh(); | |
} | |
} | |
}); | |
FooRoute = Em.Route.extend({ | |
refreshOnQueryParamChanges: ['bar'] | |
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