I am trying to add a class to a popover with:
$('#popoverbutton').addClass('someclass');
I've tried it in the document ready and sending it via onclick="myfunction();" ..
But it just won't add the class to the button that's in the template that is going to to be called when the popover is opened.
I'm thinking that it's because the popover is still not opened so could I do this after the popover is shown?
How can I get it to run some jquery as soon as the popover is loaded?
Here is the code for the controller:
$scope.usefulData = {};
$ionicModal.fromTemplateUrl('templates/mypopover.html', {
scope: $scope
}).then(function(modal) {
$scope.modalMypopover = modal;
});
$scope.closeMypopover = function() {
$scope.modalMypopover.hide();
};
$scope.mypopover = function() {
$scope.modalMypopover.show();
};
$scope.doMypopover = function() {
console.log('Doing mypopover');
$timeout(function() {
$scope.closeMypopover();
}, 1000);
};
Why don't you adopt Angular binding? I mean: set a variable on
modal.shown
event handler and useng-class
to apply a specific class based on that value.See the snippet below: