Last active
July 31, 2017 10:00
-
-
Save KarthikaRamachandran/3f9a0a5f7baeee305e594f037e599731 to your computer and use it in GitHub Desktop.
Components Callback Execution
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({ | |
| tagName: "option" | |
| }); |
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({ | |
| tagName: "select", | |
| attributeBindings: ["type:multiple","style","data-get-values"], | |
| type:"multiple", | |
| values: [], | |
| change: function(){ | |
| this.set("values", []); | |
| var selectedValue = $(this.element).val(), base = this; | |
| $.each(selectedValue, function(index, item){ | |
| base.get("values").push({"name":item}); | |
| }); | |
| }, | |
| didUpdateAttrs: function(options){ | |
| if(options.oldAttrs["data-get-values"].value !== options.newAttrs["data-get-values"].value && options.newAttrs["data-get-values"].value){ | |
| this.attrs.retrieveValues(this.get("values")); | |
| } | |
| } | |
| }); |
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', | |
| myItems: [], | |
| updateArray: false, | |
| actions:{ | |
| onFetchingValues: function(val){ | |
| this.set("myItems", val); | |
| var base = this; | |
| Ember.run.later( function(){ | |
| base.set("updateArray", false); | |
| }, 100); | |
| }, | |
| fetchValue: function(){ | |
| this.set("updateArray", true); | |
| } | |
| } | |
| }); |
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