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 { tracked } from '@glimmer/tracking'; | |
| import { action } from '@ember/object'; | |
| export default class ApplicationController extends Controller { | |
| appName = 'Input with handler example'; | |
| @tracked text; | |
| handleInput(event) { | |
| event.preventDefault(); |
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 { tracked } from '@glimmer/tracking'; | |
| import { action } from '@ember/object'; | |
| export default class ApplicationController extends Controller { | |
| appName = 'Input with handler example'; | |
| @tracked text; | |
| handleInput(event) { | |
| event.preventDefault(); |
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 { action } from '@ember/object'; | |
| export default class ApplicationController extends Controller { | |
| @action sayHello() { | |
| alert('Hello'); | |
| } | |
| } |
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
| import Controller from '@ember/controller'; | |
| import { inject as service } from '@ember/service'; | |
| import { action } from '@ember/object'; | |
| import { tracked } from '@glimmer/tracking'; | |
| export default class ApplicationController extends Controller { | |
| @service('store') store; | |
| constructor() { | |
| super(...arguments); | |
| const initial = this.store.createRecord('immutablel', { props: { name: 'Jake' }}); |
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
| const fs = require('fs'); | |
| const items = JSON.parse(fs.readFileSync('state_of_js_2016_2020.json', 'utf8')); | |
| const last = items.filter((item) => [2020].includes(item.year)); | |
| // 2_5, 5_10, 10_20 | |
| const exp = last.filter((item) => ['1_2', '2_5', '5_10', '10_20'].map(e=>`range_${e}`).includes(item.user_info.years_of_experience)); | |
| // 10_30, 30_50, 50_100, 100_200, | |
| const payd = exp.filter((item) => ['10_30','30_50', '50_100', '100_200'].map(e=>`range_${e}`).includes(item.user_info.yearly_salary)); | |
| const shape = {}; | |
| const fans = ['ember', 'react', 'angular', 'vuejs', 'other']; |
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 { action } from '@ember/object'; | |
| import { tracked } from '@glimmer/tracking'; | |
| export default class ApplicationController extends Controller { | |
| @tracked | |
| isBreaking = false; | |
| @action break() { | |
| this.isBreaking = !this.isBreaking; |
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 { alias } from '@ember/object/computed'; | |
| import { Ability } from 'ember-can'; | |
| export default Ability.extend({ | |
| model: null, | |
| canCreate: alias('model.isAdmin') | |
| }); |
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 { | |
| items = [ { name: 1 }, undefined, { name: 2} ] | |
| } |