Last active
November 7, 2019 19:03
-
-
Save aalasolutions-zz/826678b177fd8cc3c5a556533bd91160 to your computer and use it in GitHub Desktop.
New Twiddle
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.Component.extend({ | |
actions:{ | |
add(){ | |
const match = this.get('match'); | |
this.set('model', [...this.model, match].uniq()) | |
}, | |
remove(){ | |
const match = this.get('match'); | |
const index = this.get('model').indexOf(match); | |
if(index !== -1){ | |
this.get('model').splice(index, 1); | |
} | |
this.set('model', this.get('model').uniq()); | |
} | |
} | |
}); |
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.Component.extend({ | |
}); |
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', | |
//arr: ["English", "Science"], | |
init() { | |
this.set('arr', ["English", "Science"]); | |
}, | |
actions: { | |
reset() { | |
this.set('arr', ["English", "Science"]); | |
}, | |
blank() { | |
this.set('arr', []); | |
}, | |
checkValue() { | |
alert(this.get('arr')); | |
}, | |
tryForceUpdate() { | |
this.set('arr', this.arr.uniq()); | |
}, | |
add(val) { | |
if (!this.get('arr').includes(val)) { | |
this.arr.pushObject(val); | |
} | |
this.set('arr', this.get('arr').uniq()); | |
}, | |
remove(val) { | |
const index = this.get('arr').indexOf(val); | |
let arr = this.get('arr'); | |
if (index !== -1) { | |
arr.splice(index, 1); | |
} | |
this.set('arr', arr.uniq()); | |
} | |
} | |
}); |
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
body { | |
margin: 12px 16px; | |
font-family: Arial, sans-serif; | |
font-size: 12pt; | |
} | |
button{ | |
background-color: #8845; | |
font-size: 13px; | |
} |
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.15.1", | |
"EmberENV": { | |
"FEATURES": {} | |
}, | |
"options": { | |
"use_pods": false, | |
"enable-testing": false | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.js", | |
"ember": "3.4.3", | |
"ember-template-compiler": "3.4.3", | |
"ember-testing": "3.4.3" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment