Created
September 11, 2016 07:00
-
-
Save abhilashlr/ae3c8b7414778150162cb653990cc9ed to your computer and use it in GitHub Desktop.
Sort with query params
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
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle' | |
}); |
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
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
queryParams: ['sort'], | |
sort: 'desc', | |
paramsRelay: Ember.inject.service(), | |
setSort: Ember.on('init', function() { | |
// Add ember-query-params here. | |
// Basically this sort is brought from localstore. | |
// this.set('sort', 'asc'); | |
let paramsRelay = this.get('paramsRelay'); | |
paramsRelay.setParam('sort', 'asc'); | |
}) | |
}); |
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
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
queryParams: ['sort'], | |
sort: 'desc', | |
paramsRelay: Ember.inject.service(), | |
setSort: Ember.on('init', function() { | |
// Add ember-query-params here. | |
// Basically this sort is brought from localstore. | |
// this.set('sort', 'asc'); | |
let paramsRelay = this.get('paramsRelay'); | |
paramsRelay.setParam('sort', 'desc'); | |
}) | |
}); |
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
import Ember from 'ember'; | |
import config from './config/environment'; | |
const Router = Ember.Router.extend({ | |
location: 'none', | |
rootURL: config.rootURL | |
}); | |
Router.map(function() { | |
this.route('route1'); | |
this.route('route2'); | |
}); | |
export default Router; |
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
import Ember from 'ember'; | |
import AutosubscribeMixin from 'ember-query-params/mixins/autosubscribe'; | |
export default Ember.Route.extend(AutosubscribeMixin, { | |
queryParams: { | |
sort: { | |
refreshModel: true | |
} | |
} | |
}); |
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
import Ember from 'ember'; | |
import AutosubscribeMixin from 'ember-query-params/mixins/autosubscribe'; | |
export default Ember.Route.extend(AutosubscribeMixin, { | |
queryParams: { | |
sort: { | |
refreshModel: true | |
} | |
} | |
}); |
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
{ | |
"version": "0.10.4", | |
"EmberENV": { | |
"FEATURES": {} | |
}, | |
"options": { | |
"use_pods": false, | |
"enable-testing": false | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js", | |
"ember": "2.4.5", | |
"ember-data": "2.4.3", | |
"ember-template-compiler": "2.4.5" | |
}, | |
"addons": { | |
"ember-query-params": "2.1.0" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment