How to create modal confirmation dialog before uninstalling using ember-cli

I am trying to create a user manager, I can create edit and delete users. In the delete action, I want to display a modal confirmation dialog with the “continue” and “cancel” buttons to confirm user suppression.

What is the best practice for this, I use ember-cli 0.2.3, there are many offers on the network, I am a little confused with these solutions, what is the standard or the best way to create modals using Ember-CLI?

+5
source share
2 answers

You must bind your toggleModal function with the delete button and your deleteUser function with the ok button in modal mode.

For instance:

//button to call modal <button {{action 'showModal' 'modal-main'}}>Delete User</button> //ok button on the modal <button {{action 'deleteAfterConfirm' 'modal-main'}}>Ok</button> export default Ember.Controller.extend({ actions: { deleteAfterConfirm: function(userId) { if (confirm("Want to delete?");) { //deleteUser } }, showModal: function(targetId) { var modal = Ember.Views.views[targetId]; modal.send('toggleModal'); } } }); 

You can describe in detail here how to create and style your modal.

+1
source

You can use Bootstrap modal and associate the action with the continue button.

Live demo of Bootstrap modal here .

0
source

All Articles