Answer the question
In order to leave comments, you need to log in
How to organize popup windows in angular?
Hello! I have popup windows on my site. When you click certain buttons (such as "Add Code", "Add Store") they should pop up. What is the best way to organize it? Use just DOM (and CSS) or inject scope variables?
Now it works like this:
app.directive('showPopup', function () {
return {
restrict: 'A',
link: function (scope, elem, attrs) {
$(elem).click(function () {
$('#' + attrs['showPopup']).fadeIn(function () {
// некая логика
});
});
}
}
});
Answer the question
In order to leave comments, you need to log in
It is best to implement modal windows through a service.
Have a look at the ready-made solutions:
Under bootstrap angular-ui.github.io/bootstrap/#/modal
For simpler cases, I used this https://github.com/btford/angular-modal with some improvements.
In the most simplified version, it can be implemented through a directive that will simply hang an event on an element and call your popup plugin (if you have one).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question