Skip to content

Instantly share code, notes, and snippets.

Avatar
🐻
Just doing bear things

Kelly Miyashiro kmiyashiro

🐻
Just doing bear things
View GitHub Profile
View controllers.application.js
import Ember from 'ember';
export default Ember.Controller.extend({
primitiveFruits: ['banana' ,'apple'],
wrappedFruits: [{name: 'banana'}, {name: 'apple'}],
printPrimitiveFruits() {
console.log(this.get('primitiveFruits'));
},
printWrappedFruits() {
View components.a-component.js
import Ember from 'ember';
export default Ember.Component.extend({
myArray: Ember.A(),
});
View controllers.application.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
myArray: Ember.A(['foo', 'bar']),
actions: {
replace() {
this.get('myArray').replace(0, 1, ['baz', 'wombat'])
}
View controllers.application.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
actions: {
createApproval() {
const approval = this.store.createRecord('approval', { name: this.get('model.length') })
console.log(approval)
}
@kmiyashiro
kmiyashiro / controllers.application.js
Created Jan 9, 2018
Editing cached value of new computed array
View controllers.application.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
things: [1, 2, 3],
computedArray: Ember.computed('things.[]', function() {
return Ember.A(this.get('things').slice());
}),
actions: {
pushToComputed() {
View controllers.application.js
import Ember from 'ember';
function createChecklist(i) {
return Ember.Object.create({
key: i
});
}
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
View components.my-component.js
import Ember from 'ember';
export default Ember.Component.extend({
didInsertElement() {
this.set('$parentEl', Ember.$('.parent'));
this.get('$parentEl').on('click', () => { console.log('parent clicked'); })
},
willDestroyElement() {
this.sendAction('isParentDestroyed');
console.log('child destroying');
View controllers.application.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
View application.controller.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName:'Ember Twiddle'
});
View gist:3490998
npm ERR! Error: No compatible version found: connect@'>=2.4.4- <2.5.0-'
npm ERR! Valid install targets:
npm ERR! ["0.0.1","0.0.2","0.0.3","0.0.4","0.0.5","0.0.6","0.1.0","0.2.0","0.2.1","0.2.2","0.2.3","0.2.4","0.2.5","0.2.6","0.2.7","0.3.0","0.4.0","0.5.0","0.5.1","0.5.2","0.5.3","0.5.4","0.5.5","0.5.6","0.5.7","0.5.8","0.5.9","0.5.10","1.0.0","1.0.1","1.0.2","1.0.3","1.0.4","1.0.5","1.0.6","1.1.0","1.1.1","1.1.2","1.1.3","1.1.4","1.1.5","1.2.0","1.2.1","1.2.2","1.2.3","1.3.0","1.4.0","1.4.1","1.4.2","1.4.3","1.4.4","1.4.5","1.4.6","1.5.0","1.5.1","1.5.2","1.6.0","1.6.1","1.6.2","1.6.3","1.6.4","1.7.0","1.7.1","1.7.2","1.7.3","1.8.0","1.8.1","1.8.2","1.8.3","1.8.4","1.8.5","2.0.0","2.0.1","2.0.2","2.0.3","1.8.6","2.1.0","2.1.1","2.1.2","1.8.7","2.1.3","2.2.0","2.2.1","2.2.2","2.3.0","2.3.1","2.3.2","2.3.3","1.9.0","1.9.1","2.3.4","2.3.5","2.3.6","2.3.7","1.9.2","2.3.8","2.3.9","2.4.0","2.4.1","2.4.2","2.4.3"]
npm ERR! at installTargetsError (/usr/local/lib/node_modules/npm/lib/cache.js:553:10)
npm ERR!