Created
March 27, 2014 17:33
-
-
Save apcomplete/9813274 to your computer and use it in GitHub Desktop.
Ember easyForm array input using Zurb Foundation
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
Ember.EasyForm.ArrayInput = Ember.View.extend | |
classNames: ["row"] | |
templateName: 'easyForm/array_input' | |
valueItems: (-> | |
@get('value').map (item) -> | |
{ value: item } | |
).property() | |
valueItemsDidChange: (-> | |
@set('value', @get('valueItems').getEach('value')) | |
).observes('[email protected]') | |
actions: | |
addItem: -> | |
@get('valueItems').pushObject({ value: '' }) | |
removeItem: (item) -> | |
@get('valueItems').removeObject(item) | |
Ember.EasyForm.Config.registerInputType('array', Ember.EasyForm.ArrayInput) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment