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({ | |
isShowingOverview: false, | |
actions: { | |
toggleOverviewVisibility() { | |
this.toggleProperty('isShowingOverview'); | |
} | |
} |
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({ | |
// required params | |
person: null, | |
actions: { | |
onSnooze() { | |
this.set('person.isAwake', false); | |
}, |
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
// one-line, with meaningful logic | |
function showAlert(text) { | |
if (!text) console.error('You didn't enter any text!); | |
alert(text); | |
} | |
// one-line, with `return` | |
function showAlert(text) { | |
if (!text) return; | |
alert(text); |
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
// Page Object Helper. | |
// See http://ember-cli-page-object.js.org/docs/v1.8.x/components#custom-helper | |
import Ember from 'ember'; | |
import { findElementWithAssert } from 'ember-cli-page-object'; | |
function dynamicTriggerable(eventName, selector, options = {}) { | |
return { | |
isDescriptor: 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 Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle', | |
store: Ember.inject.service(), | |
init() { | |
this._super(...arguments); | |
const foo = this.get('store').createRecord('foo', { | |
id: 'foo-id' |
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 { | |
create, | |
hasClass, | |
isVisible | |
} from 'ember-cli-page-object'; | |
import { getter } from 'ember-cli-page-object/macros'; | |
// the old way | |
const page = create({ | |
foo: isVisible('button'), |
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'; | |
// Computed Properties: https://emberjs.com/api/ember/2.15/namespaces/Ember.computed | |
export default Ember.Controller.extend({ | |
allStudents: Ember.computed.reads('model') | |
}); |
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: ['MyComponent'] | |
}); |
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({ | |
isDisabled: false, | |
actions: { | |
foo() { | |
alert('Foo!'); | |
} | |
} |
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'; | |
import withInitialValues from 'app/utils/with-initial-values'; | |
// With the Safe code commented in, | |
// clicking on the list labeled "Instance 1" or "Instance 2" | |
// will only result in a change to the clicked list. | |
// | |
// With the Unsafe code commented in, | |
// clicking on the list labeled "Instance 1" or "Instance 2" |
OlderNewer