Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
139
rated 0 times [  146] [ 7]  / answers: 1 / hits: 21049  / 4 Years ago, tue, january 28, 2020, 12:00:00

I want to show a popup message when i click on select button like you have selected this event



how to do in angular 2?



<button type=button class=button event-buttons [disabled]=!owned style=(click)=eventSet()>
SELECT
</button>

More From » html

 Answers
94

You can use a structural directive *ngIf to create popup, my example:



<button type=button(click)=popup = true>
SELECT
</button>


<div class=overlay *ngIf=popup>
<div class=popup>
<h2>Here i am</h2>
<a class=close (click)=popup = false>&times;</a>
<div class=content>
you have selected this event
</div>
</div>
</div>


some styles:



.overlay {
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
background: rgba(0, 0, 0, 0.7);
transition: opacity 500ms;
visibility: visible;
opacity: 1;
}


.popup {
margin: 70px auto;
padding: 20px;
background: #fff;
border-radius: 5px;
width: 30%;
position: relative;
transition: all 5s ease-in-out;
}

.popup h2 {
margin-top: 0;
color: #333;
font-family: Tahoma, Arial, sans-serif;
}
.popup .close {
position: absolute;
top: 20px;
right: 30px;
transition: all 200ms;
font-size: 30px;
font-weight: bold;
text-decoration: none;
color: #333;
}
.popup .close:hover {
color: #06D85F;
cursor: pointer;
}
.popup .content {
max-height: 30%;
overflow: auto;
}

@media screen and (max-width: 700px){

.popup{
width: 70%;
}
}


https://stackblitz.com/edit/angular-g4rdha?file=src%2Fapp%2Fapp.component.ts



Hope it helps!


[#51268] Friday, January 17, 2020, 4 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
maryann

Total Points: 600
Total Questions: 104
Total Answers: 97

Location: Sint Maarten
Member since Tue, Mar 29, 2022
2 Years ago
;