I have a button that calls a method. When the method is called, I would like to have the button change and show a spinner (inside the button itself).
I have made the button itself and the css for it.
However, I am lost in how I could hook this up with functionality to show the spinner when the method is called and stop showing it when the method returns successfully.
How can I do this? (using
Template.subscriptionReady
?)
-----------------------------------------------------------------------------------------------------------------
- ANSWER -
The simplest solution is to activate the spinner in the event and deactivate it in the method call callback:
'click #methodButton' : function() {
activateSpinner();
Meteor.call('method', function(ess, res) {
if(err) throw err;
deactivateSpinner();
});
}
0 comments:
Post a Comment