Forked from chriskrycho/controllers.application.js
Created
September 11, 2018 19:36
-
-
Save alexdiliberto/afcd39e8a3c91b77c0de430fd8ea2cd0 to your computer and use it in GitHub Desktop.
get-not-working
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 Controller from '@ember/controller'; | |
import { get, set } from '@ember/object'; | |
import { action, computed } from '@ember-decorators/object'; | |
export default class ApplicationController extends Controller { | |
init() { | |
super.init(...arguments); | |
const initial = [ | |
{ 'email.address': 'hello@example' }, | |
{ 'email.address': 'goodbye@example' }, | |
]; | |
const selected = initial | |
.reduce((dict, { 'email.address' }) => Object.assign({}, dict, { [emailAddress]: false }), {}); | |
this.setProperties({ initial, selected }); | |
} | |
@action | |
toggleAll() { | |
const updated = Object.entries(this.selected) | |
.reduce((dict, [k, v]) => Object.assign({}, dict, { [k]: !v }), {}); | |
set(this, 'selected', updated); | |
} | |
@computed('selected') | |
get selectedAsString() { | |
return Object.entries(this.selected) | |
.reduce((dict, [k, v]) => Object.assign({}, dict, { [k]: `${v}` }), {}); | |
} | |
} |
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.15.0", | |
"EmberENV": { | |
"FEATURES": {} | |
}, | |
"options": { | |
"use_pods": false, | |
"enable-testing": false | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js", | |
"ember": "3.2.2", | |
"ember-template-compiler": "3.2.2", | |
"ember-testing": "3.2.2" | |
}, | |
"addons": { | |
"ember-data": "3.2.0", | |
"ember-decorators": "2.4.1" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment