I want to show a popup with bucket-modal.component.ts
when the user hovers / mouse over list.component.ts
. How to establish a connection between list.component.ts
and bucket-modal.component.ts
? My code is here.
list.component.ts
@Component({
selector: 'list',
templateUrl: 'list.component.html',
styleUrls: ['list.component.css'],
})
export class ListComponent implements OnInit {
@Input() state: boolean;
@Output() toggle = new EventEmitter();
onHover() {
this.state = true;
this.toggle.emit(this.state);
console.log("state is ----------" + this.state);
}
onHoverOut() {
this.state = false;
this.toggle.emit(this.state);
console.log("state is------ " + this.state);
}
}
list.component.html
<a (mouseover)="onHover()" (mouseleave)="onHoverOut()">random Link list</a>
listdetails.component.ts
@Component({
selector: 'app-list-detail',
templateUrl: 'app-list.component.html',
styleUrls: ['app-list.component.css'],
})
export class ListDetailComponent implements OnInit {
}
listdetails.component.html
<list [elementslist]="listdetails" listingtype="3"></list>
<list [elementslist]="listdetails" listingtype="3"></list>
<list [elementslist]="listdetails" listingtype="3"></list>
<bucket-modal [(showMeaddBucket)]="show2ClickedBucket" [state]="PopUpshow" (toggle)="PopUpshow=$event"></bucket-modal>
Bucket-modal.component.ts
@Component({
selector: 'bucket-modal',
templateUrl: 'bucket-modal.component.html',
styleUrls: ['bucket-modal.component.css'],
})
export class BucketModalComponent implements OnInit {
@Input() state: boolean;
@Output() toggle = new EventEmitter();
onHover() {
this.state = true;
this.toggle.emit(this.state);
console.log("state is " + this.state);
}
onHoverOut() {
this.state = false;
this.toggle.emit(this.state);
console.log("state is " + this.state);
}
}
source
share