I'm having a problem hiding and showing an element in angular 4.
My Html:
<div class='row'>
<div class='col-md-4 imgTxt' *ngFor="let path of imagePaths" >
<img [id]='path.id' (mouseenter)="ent(path.img)" class="d-block w- 100 image" [src]='path.img' alt="Third slide">
<div class="middle">
<div class="text">{{path.txt}}</div>
</div>
</div>
</div>
Initially , I want to hide the div(class='middle'). The particular middle div will show when i hover the mover on image.
My ts file: enter image description here
export class SpecialityComponent implements OnInit {
imagePaths ;
constructor() {
this.imagePaths = [
{id:"a",img:'assets/images/3.JPG',txt:'Breakfast'},
{id:"b",img:'assets/images/1.JPG',txt:'Lunch'},
{id:"c",img:'assets/images/2.JPG',txt:'Dinner'},
{id:"d",img:'assets/images/3.JPG',txt:'Breakfast'},
{id:"e",img:'assets/images/1.JPG',txt:'Lunch'},
{id:"f",img:'assets/images/2.JPG',txt:'Dinner'}
];
}
ngOnInit() {
}
}
My output: enter image description here
Thanks in advance.