Created
April 27, 2021 07:57
-
-
Save seanCodes/1a8746cf24418f7ffc5e23373402ef1e to your computer and use it in GitHub Desktop.
Inconsistent sorted list
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
import { inject as service } from '@ember/service'; | |
import Controller from '@ember/controller'; | |
export default class ApplicationController extends Controller { | |
@service | |
store; | |
get sortedTodos() { | |
return this.model.sortBy('isDone'); | |
} | |
} |
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
import Model from 'ember-data/model'; | |
import attr from 'ember-data/attr'; | |
export default class TodoModel extends Model { | |
@attr | |
text; | |
@attr('boolean', { defaultValue: false }) | |
isDone; | |
} |
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
import { inject as service } from '@ember/service'; | |
import Route from '@ember/routing/route'; | |
export default class ApplicationRoute extends Route { | |
@service | |
store; | |
model() { | |
this.store.push({ | |
data: [ | |
{ type: 'todo', id: '1', attributes: { text: 'Todo 1', isDone: false } }, | |
{ type: 'todo', id: '2', attributes: { text: 'Todo 2', isDone: false } }, | |
{ type: 'todo', id: '3', attributes: { text: 'Todo 3', isDone: false } }, | |
], | |
}); | |
return this.store.peekAll('todo') | |
} | |
} |
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
body { | |
margin: 1em 2em; | |
font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji; | |
} | |
ul { | |
list-style-type: none; | |
} | |
li { | |
margin-bottom: 0.5em; | |
} | |
input:focus { | |
outline: 3px solid hsla(210, 100%, 70%, 0.5); | |
} |
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
{ | |
"version": "0.17.1", | |
"EmberENV": { | |
"FEATURES": {}, | |
"_TEMPLATE_ONLY_GLIMMER_COMPONENTS": false, | |
"_APPLICATION_TEMPLATE_WRAPPER": true, | |
"_JQUERY_INTEGRATION": true | |
}, | |
"options": { | |
"use_pods": false, | |
"enable-testing": false | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.js", | |
"ember": "3.18.1", | |
"ember-template-compiler": "3.18.1", | |
"ember-testing": "3.18.1" | |
}, | |
"addons": { | |
"@glimmer/component": "1.0.0", | |
"ember-data": "3.18.0" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment