last day (15 days later) » 

1:30 PM
0
Q: How to get data from anchor tag click event Angular 7

Thevin Malaka.Hay in my angular project, have search input box. In here i want to get id, when click the anchor tag. I will try to put click function to anchor tag, but it's did not work. Can you help me. Angular 7 cli Component.html <div class="form-group"> <div class="search"> <div class="...

 
did not have any error. But as well as did not have alert. I don't know why.
 
can you post the entire component.ts please. Also, try stopping and restarting your app.
 
@Jacques i added to code.
@skdroid I will try console.log but did not have any result.
 
Can you add what is logged when you console.log this.pharmacyData?
 
@Jacques did not have any result friend.
 
1:30 PM
@ThevinMalaka. To clarify, I'm asking about the console log in your ngOnInit method
 
@Jacques oh sorry. It's (2) [{…}, {…}]
 
@ThevinMalaka. ....... I need to see what's in the objects. Paste what is returned from your request in your answer.
 
@Jacques i did..
 
Works just fine... angular-4swwue.stackblitz.io
 
ooooh... then i think misatek had in css file.. i will add css can you help me.
### Component.css

/* for pharmacy search part */
a {
text-decoration: none;
}

a:hover { text-decoration: underline }


.search input {
box-sizing: border-box;
}

.search input:focus {
outline: none;
}

.search input:focus + .results { display: block }

.search .results {
display: none;
position: absolute;
top: 35px;
left: 0;
right: 0;
z-index: 10;
}

.search .results li { display: block }

.search .results li:first-child { margin-top: -1px }

.search .results li:first-child:before, .search .results li:first-child:after {
 
1:33 PM
Honestly, I don't know what you're trying to do, but I'm going to bed. The only way I can think of that css could affect your clicking on the item is that you have a z-index issue.
If you post a stackblitz reproducing your problem, I can look when I get up in the morning.
 
oh... sorry sorry, i will try friend. any way thank you.. :)
 

last day (15 days later) »