Last active
May 8, 2018 15:50
-
-
Save thoov/985e5689058bee791874e88c16899c00 to your computer and use it in GitHub Desktop.
Thought exercise on "Ember Controllerless"
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 Route from '@ember/routing/route'; | |
import { action } from '@ember-decorators/object'; | |
import { model } from '@ember-decorators/model'; | |
export Class extends Route { | |
@service queryParams | |
@model | |
data() { | |
const { sort } = this.queryParams.forRoute(this) | |
// Anything returned from here would be accessible on the | |
// template via `data` | |
return fetch(`/v1/data?sort=${sort}`).then(res => res.json()); | |
} | |
willEnter() {} | |
didEnter() {} | |
willLeave() {} | |
didLeave() {} | |
@action | |
someAction() { | |
// ... | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment