Meteor: the correct way to add a “confirm delete” modal

I want to create a confirmation popup using Bootstrap 3. Are there any good comprehensive examples of how to build them? I am very new to Meteor.

+4
source share
1 answer

Use some example from Codrops, etc., just remember to put the AOD inside

Template.nameTemplate.rendered = function() {}

So this means that meteor loads this jscode when the template has been processed, and it can load any modal, etc.

So just follow the example you want and just install the jQuery plugin, etc. inside the rendered function

, , docs , , , , meteorPad, o repo github, ( , trickys = p)

meteor add iron:router, /app.js

Router.route('/', function () {
  this.render('leaderboard');
});

, .

    Template.deleteBtn.rendered = function(){

  $('.open-modal').on('click', function(e){
    $('#confirm').modal()
        .on('click', '#delete', function (e) {
            // Remove selected player
            Players.remove(Session.get("selectedPlayer"));

        });
  });
  }

UPDATE

, peppelg:bootstrap-3-modal,

<template name="modal">
<!-- Modal Stuff -->
</template>

.

Template.example.events({
 'click #exampleButton':function(){
   Modal.show('modal')
  }
})

, 1-23 app.'s 41-62 main.html

+2
source

Source: https://habr.com/ru/post/1570480/


All Articles