Last active
May 31, 2017 06:45
-
-
Save feanor07/1b6bfeec6f597dd870cd16042d4e3aa2 to your computer and use it in GitHub Desktop.
so#44265137
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 {computed, Component} = Ember; | |
const eachBy4 = Component.extend({ | |
tagName:'', | |
subLists: computed('list', 'splitSize', function() { | |
let list = this.get('list'); | |
let splitSize = 4; | |
let result = []; | |
for (let i = 0; i < list.length; i=i+splitSize) { | |
result.push(list.slice(i, i+splitSize)); | |
} | |
return result; | |
}) | |
}); | |
eachBy4.reopenClass({ | |
positionalParams: ['list'] | |
}); | |
export default eachBy4; |
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 {computed, Component} = Ember; | |
const eachn = Component.extend({ | |
tagName:'', | |
subJsons: computed('list', 'splitSize', function() { | |
let list = this.get('list'); | |
let splitSize = this.get('splitSize'); | |
let result = []; | |
for (let i = 0; i < list.length; i=i+splitSize) { | |
let newJSON = {}; | |
for (let j = i; j < i+splitSize; j++) { | |
newJSON[`item${(j-i+1)}`] = list[j]; | |
} | |
result.push(newJSON); | |
} | |
return result; | |
}) | |
}); | |
eachn.reopenClass({ | |
positionalParams: ['list', 'splitSize'] | |
}); | |
export default eachn; |
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'; | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle', | |
list: [1,2,3,4,5,6,7,8,9,10,11] | |
}); |
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.12.1", | |
"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.12.0", | |
"ember-template-compiler": "2.12.0", | |
"ember-testing": "2.12.0" | |
}, | |
"addons": { | |
"ember-data": "2.12.1" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment