Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save ASH-Anthony/522cc5bceb6bd3f615764d6904f3c49b to your computer and use it in GitHub Desktop.

Select an option

Save ASH-Anthony/522cc5bceb6bd3f615764d6904f3c49b to your computer and use it in GitHub Desktop.
New Twiddle
import Ember from 'ember';
export default Ember.Component.extend({
actions:{
submitConfirm() {
if (this.args.onConfirm) {
// call `onConfirm` with a second argument
await this.args.onConfirm(this.confirmValue);
}
this.showConfirmation = false;
}
}
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
actions:{
sendMessage(messageType, messageText) {
// send message here and return a promise
}
}
});
<h1>Welcome to {{appName}}</h1>
<br>
<br>
<ButtonWithConfirmation
@text="Click to send your message."
@onConfirm={{action this.sendMessage "info"}}
as |confirmValue|>
<Input @value={{confirmValue}} />
</ButtonWithConfirmation>
{{outlet}}
<br>
<br>
<button type="button" {{action this.launchConfirmDialog}}>{{this.text}}</button>
{{#if this.confirmShown}}
<div class="confirm-dialog">
{{yield this.confirmValue}}
<button class="confirm-submit" type="button" {{action this.submitConfirm}}>OK</button>
<button class="confirm-cancel" type="button" {{action this.cancelConfirm}}>Cancel</button>
</div>
{{/if}}
{
"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"
},
"addons": {
"ember-data": "3.4.2"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment