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 Component from '@glimmer/component'; | |
import { inject as service } from '@ember/service'; | |
import { action } from '@ember/object'; | |
import { tracked } from '@glimmer/tracking'; | |
export default class extends Component { | |
@service session; | |
@service myService; | |
@tracked value; | |
@tracked count = 0; |
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 Component from '@ember/component'; | |
import Changeset from "ember-changeset"; | |
import lookupValidator from "ember-changeset-validations"; | |
import { | |
validatePresence | |
} from 'ember-changeset-validations/validators'; | |
const ComponentValidations = { | |
email: [ | |
validatePresence(true) |
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 Component from '@glimmer/component'; | |
import { action } from '@ember/object'; | |
import { tracked } from '@glimmer/tracking'; | |
import LoginValidations from '../validations/login'; | |
import lookupValidator from 'ember-changeset-validations'; | |
import { Changeset } from 'ember-changeset'; | |
import MyChangeset from './my-changeset'; | |
import { scheduleOnce, schedule } from '@ember/runloop'; | |
export default class extends Component { |
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 Component from '@glimmer/component'; | |
import { get, set, computed } from '@ember/object'; | |
export default class extends Component { | |
// Why does this work? Isn't it like A.? | |
get firstArrayObject() { | |
return this.args.myArray[0]; | |
} | |
// A. This does not work |
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 Component from '@ember/component'; | |
import {computed} from '@ember/object'; | |
export default Component.extend({ | |
count: 0, | |
init() { | |
this._super(...arguments); | |
console.log('parent'); | |
}, | |
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 Component from '@glimmer/component'; | |
import { tracked } from '@glimmer/tracking'; | |
import { get } from '@ember/object'; | |
export default class extends Component { | |
get isCountSet() { | |
return this.args.object.count; | |
} | |
get isTestSet() { |
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 Component from '@glimmer/component'; | |
import { action, computed } from '@ember/object'; | |
import { inject as service } from '@ember/service'; | |
export default class extends Component { | |
@service alarms; | |
get currentAlarmsKey1() { | |
console.log('computed key 1'); | |
return this.alarms.alarms['key1']; |
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 Ember from 'ember'; | |
export default Ember.Component.extend({ | |
classNames: ['classname-1', 'classname-2'], | |
classNameBindings: ['class4:classname-4'], | |
actions: { | |
// Add class3 using jquery | |
addClass3: function() { |
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 Ember from 'ember'; | |
export default Ember.Component.extend({ | |
actions: { | |
destroyComp: function() { | |
this.destroy(); | |
} | |
} | |
}); |
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 Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle', | |
items: [], | |
i: 1, | |
isAnimating: false, | |
actions: { | |
addItem: function() { |