Created
July 27, 2020 13:42
-
-
Save 22a/872f72a918ea1b90f4f95a9286350eda to your computer and use it in GitHub Desktop.
tracked-property-index
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 Component from '@ember/component'; | |
import EmberObject, { computed } from '@ember/object'; | |
export default Component.extend({ | |
nums: undefined, | |
errors: undefined, | |
init() { | |
this._super(...arguments); | |
this.set('nums', [1,2,3,4,5]); | |
this.set('errors', EmberObject.create()); | |
setTimeout(this.validateNums.bind(this), 100); | |
}, | |
validateNums() { | |
console.log('validating numbers'); | |
this.set('nums', this.nums.map((link, index) => { | |
if (link % 2 === 0) { | |
this.errors.set(index, 'bad number, divisible by 2'); | |
} else { | |
this.errors.set(index, null); | |
} | |
return link; | |
})); | |
} | |
}) |
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'; | |
export default class ApplicationController extends Controller { | |
appName = 'Ember Twiddle'; | |
} |
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" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment