Last active
December 12, 2018 02:54
-
-
Save gdgupta11/8230324db811e5e295e6343bfa792f82 to your computer and use it in GitHub Desktop.
Basics_action_bubbling
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
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
appName: 'Ember Twiddle', | |
hasHat: true, | |
hatColor: "blue", | |
colors: ["blue", "red","green", "yellow", "black", "purple", "orange"], | |
actions: { | |
putOnHat(color){ | |
this.set('hatColor', color); | |
this.set('hasHat', true); | |
}, | |
takeOffHat(){ | |
this.set('hasHat', false); | |
return true; | |
}, | |
pressRelease(){ | |
alert("This action is taking place in controller"); | |
// while mentioning return as true it bubbles the action for next execution as well. | |
// otherwise if there are multiple same actions defined in different places, only first will execute | |
return true; | |
} | |
} | |
}); |
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
import Ember from 'ember'; | |
import config from './config/environment'; | |
const Router = Ember.Router.extend({ | |
location: 'none', | |
rootURL: config.rootURL | |
}); | |
Router.map(function() { | |
}); | |
export default Router; |
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
import Ember from 'ember'; | |
export default Ember.Route.extend({ | |
actions: { | |
pressRelease(){ | |
alert("This is press release and action is taking in application.js"); | |
} | |
} | |
}); |
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
{ | |
"version": "0.13.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.16.2", | |
"ember-template-compiler": "2.16.2", | |
"ember-testing": "2.16.2" | |
}, | |
"addons": { | |
"ember-data": "2.16.3" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment