Skip to content

Instantly share code, notes, and snippets.

@pvmsikrsna
Created July 19, 2016 16:45
Show Gist options
  • Select an option

  • Save pvmsikrsna/d4270bedde58c1381608c743c0b7b861 to your computer and use it in GitHub Desktop.

Select an option

Save pvmsikrsna/d4270bedde58c1381608c743c0b7b861 to your computer and use it in GitHub Desktop.
Tiwddle1
import Ember from 'ember';
export default Ember.Component.extend({
times : 0,
actions : {
clicked(){
this.set('times',this.get('times') + 1);
alert('Clicked the button ' + this.get('times'));
this.sendAction('handler',this.get('times'));
}
}
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
actions : {
clickEventHandler(timesClicked){
alert("Caught sent action 'handler' from the component 'send-action-example'" + timesClicked);
}
}
});
<h1>Welcome to {{appName}}</h1>
<br>
<br>
{{send-action-example handler='clickEventHandler'}}
{{outlet}}
<br>
<br>
{{#if hasBlock}}
{{yield}}
{{else}}
<input type="button" {{action 'clicked'}}
value="Click Me">
{{/if}}
{
"version": "0.10.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.6.0",
"ember-data": "2.6.1",
"ember-template-compiler": "2.6.0"
},
"addons": {}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment