I currently have this block of code:
$('.btn').click(function() {
$(this).removeClass('big-red-button');
$(this).addClass('btn-loading');
$(this).find('.text').text('Working..');
$(this).find('.state').addClass('loading');
$(this).find('i').replaceWith('<img src="/images/loading.gif">'+'</img>');
});
What it does is when the specified button is clicked it changes the buttons CSS, disables it and sets the text to "Working.." this is to let the user know that an action is being executed, i know there are other ways of doing this but i prefer this way. My issue now is i am using angularjs and i have ng-click on the button that executes a function, now before that function starts i wat to execute the above jquery code and when the function completes i want to execute a similar jquery code to change the buttons properties again.
This is my ng-click function():
$scope.addTicket = function(ticket, schedule_id) {
// Set button into working state
// Do stuff here
// Set button into completed state
};
Now if i was using jquery alone i would be able to do this but now i do not know how to make my jquery code work with angular.