I am facing an issue with my Angular component code. Here is the code snippet:
i=18;
onScrollDown(evt:any) {
setTimeout(()=>{
console.log(this.i)
this.api.getApi().subscribe(({tool,beuty}) => {
if (evt.index === 0) {
this.beu=beuty.slice(0,this.i+=15);
console.log('hello');
}
if(evt.index===1){
this.tools=tool.slice(0,this .i+=15);
}
})
},1000);
}
Below is the code in my template:
<mat-tab-group mat-align-tabs="start" (selectedTabChange)="onScrollDown($event)">
The problem I am encountering is that the if
statements are not functioning as expected and the 'hello' message is not appearing in the console after scrolling. Can you help identify what could be causing these issues with the if
statements?