Reputation: 1
Here is the problem I want to solve.
<div class="row" style="overflow:hidden;">
<app-car
*ngFor="let car of cars; trackBy: trackByFunction"
[car]="car"
>
</app-car>
</div>
<button> More <button>
I want to show the more button if there are cars hidden by the overflow:hidden property of the parent.
Upvotes: 0
Views: 51
Reputation: 129
You can use viewChild and ngIf in angular6 to achieve your situation
<div class="row" style="overflow:auto;height:50px" #container>
<app-car
*ngFor="let car of cars; trackBy: trackByFunction"
[car]="car">
</app-car>
</div>
<button *ngIf="container.style.overflow === 'hidden'"> More <button>
and include below item in your ts file
@ViewChild('container') private container: ElementRef;
Upvotes: 0
Reputation: 21
jquery;
$("div").each(function() {
if($(this).parent().css('overflow') == 'hidden'){
console.log("there is an overflow hidden");
}
});
Upvotes: 1