Created
November 14, 2016 22:06
-
-
Save miguelcobain/0b22845d742582fab01e752a68ed298a to your computer and use it in GitHub Desktop.
array change
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 Ember from 'ember'; | |
const { Controller, computed } = Ember; | |
let Item = Ember.Object.extend({ | |
now: computed(function() { | |
return new Date(); | |
}) | |
}); | |
export default Controller.extend({ | |
appName: 'Ember Twiddle', | |
init() { | |
this._super(...arguments); | |
let items = [1, 2, 3, 4, 5].map((i) => { | |
return Item.create({ | |
id: i, | |
name: `Item ${i}`, | |
}); | |
}); | |
this.set('items', items); | |
}, | |
actions: { | |
splice() { | |
let items = this.get('items'); | |
this.set('items', items.splice(1, 2)); | |
} | |
} | |
}); |
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.10.6", | |
"EmberENV": { | |
"FEATURES": {} | |
}, | |
"options": { | |
"use_pods": false, | |
"enable-testing": false | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js", | |
"ember": "2.9.0", | |
"ember-data": "2.9.0", | |
"ember-template-compiler": "2.9.0", | |
"ember-testing": "2.9.0" | |
}, | |
"addons": {} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment